NetTalk Central

Author Topic: NetTalk work with Google map  (Read 22489 times)

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
NetTalk work with Google map
« on: May 19, 2009, 07:45:47 PM »
Hi,

    Does any one know, how to make NetTalk to work with Google map,  i.e such as find and point to a road in the Google map.

    Regards

Terry Ho

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk work with Google map
« Reply #1 on: May 19, 2009, 08:58:17 PM »
Hi Terry,

I've not done this before, so I can only give you general advice.

Firstly - can you form a URL, in your browser, that does this. If so then it's not hard to take the results of that URL and embed it in your app.

So the problem then becomes one of forming the correct URL - and I guess you need to read some google docs, or do some experimenting, to figure that out.

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk work with Google map
« Reply #2 on: May 19, 2009, 08:59:53 PM »
Hi Terry,

You didn't mention if this is in the context of a web app, or a windows app. If a windows app, then the best tool to use is CapeSoft File Explorer which allows you to display a web page as a control in your app.

You still need to figure out the appropriate URL though.

Cheers
Bruce

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: NetTalk work with Google map
« Reply #3 on: May 20, 2009, 09:11:03 PM »
Hi all,

    Thanks your advice.
   
     Use correct URL with NetTalk then can use with Google map.

     Regards

Terry Ho

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetTalk work with Google map
« Reply #4 on: May 21, 2009, 02:06:24 AM »
Terry, may you please post an example?
Thanks
Alberto
-----------
Regards
Alberto

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: NetTalk work with Google map
« Reply #5 on: May 21, 2009, 03:31:40 AM »
Hi Terry,

Assuming you mean hosting it on a nettalk server, here is how i do it:

1st example: Google Maps - http://boydell.com.au/displayproperty?c=3295&t=R&o=44

2nd example: Google Maps + Google Street View - http://web.agencyone.net.au/displayproperty?c=5397&t=R&o=68

Both these sites are in NetTalk. View source to see how the javascript works.

Add this into your page up the top:


<script type="text/javascript">
  google.load("maps", "2.x");
  function initialize() {
    if (google.maps.BrowserIsCompatible()) {
      var map = new google.maps.Map2(document.getElementById("map"));
      map.addControl(new google.maps.SmallMapControl());
      map.addControl(new google.maps.MapTypeControl());
      map.enableDoubleClickZoom();
      map.enableContinuousZoom();
      var point = new google.maps.LatLng(-27.435019,153.055122)
      map.setCenter(point, 15);
      var marker = new google.maps.Marker(point);
      map.addOverlay(marker);
    }
  }
  google.setOnLoadCallback(initialize);
</script>


Put this in your page where you want the map to appear:

<div id="map" style="width: 600px; height: 400px"></div>

Your body tag also needs to have this paramater:

<body onunload="GUnload()">

The lat (-27.435019) and long (153.055122) will need to be determined.

I used clarion code and nettalk for this (we geocode all our addresses beforehand and save in our database)


Geocode              PROCEDURE (lAddress,lLat,lLong)       ! Declare Procedure
DATA
lResult     STRING(4096)
lTempStr    STRING(255)
_Address    STRING(255)
CODE
  lLat  = 0
  lLong = 0

  _Address = CLIP(lAddress) & ', AUSTRALIA '

  lResult = GetWebResource('http://maps.google.com/maps/geo?output=xml&key=ABQIAAAApp1Rcx2dBQ7pq4dEoAe_gxS-GNOCTuXEuEX_V8KEsLZWwbLQ4BTwBNzqaL7pWVQVMGMDxrqDnrDmNw&q='&CLIP(_Address))

  lTempStr= ''
  Pos# = INSTRING('<code>',lResult,1,1)
  IF Pos# ~= 0
    lTempStr = SUB(lResult,Pos#+6,255)
    Pos# = INSTRING('</code>',lTempStr,1,1)
    IF Pos# ~= 0
      lTempStr = SUB(lTempStr,1,Pos#-1)
    .
  .

  lStatusCode# = lTempStr

  IF lStatusCode# = 200
    Pos# = INSTRING('<coordinates>',lResult,1,1)
    IF Pos# ~= 0
      lTempStr = SUB(lResult,Pos#+13,255)
      Pos# = INSTRING('</coordinates>',lTempStr,1,1)
      IF Pos# ~= 0
        lTempStr = SUB(lTempStr,1,Pos#-1)
        Pos# = INSTRING(',',lTempStr,1,1)
        IF Pos# ~= 0
          lLong = SUB(lTempStr,1,Pos#-1)
          lLat  = SUB(lTempStr,Pos#+1,255)
        .
      .
    .
  ELSE
    !Failed
    lLat  = 0
    lLong = 0
  .


GetWebResource is one of my clarion functions using NetTalk to return the webpage in a string. Good for basic webservice stuff. The google response is in XML, most of the result i'm not interested in, so rather that parse to XML properly, i just look for the bits i need.

Lose the 'AUSTRALA' bit, thats to ensure we don't get any crazy geocodes in other countries.

You'll need to register with google maps for an account to get a web service key

key=ABQIAAAApp1Rcx2dBQ7pq4dEoAe_gxS-GNOCTuXEuEX_V8KEsLZWwbLQ4BTwBNzqaL7pWVQVMGMDxrqDnrDmNw

Thats one of mine and its bound to one of my IP addresses, so you'll need your own.

Regards
Bill Shields

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetTalk work with Google map
« Reply #6 on: May 21, 2009, 08:13:55 AM »
Thanks Bill!

And... how do you do that beautyfull image viewer?

Thanks
Alberto
-----------
Regards
Alberto

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: NetTalk work with Google map
« Reply #7 on: May 23, 2009, 01:25:56 AM »
Hi Alberto,

Thats a flash control, it gets a list of images from an XML webservice call into my nettalk server, we use a few different types of image viewers.

Flash: http://web.agencyone.net.au/displayproperty?c=5397&t=R&o=68

Javascript: http://web.agencyone.net.au/displayproperty?c=5203&t=r&o=74

Stock HTML: http://www.rtforsyth.com.au/displayproperty?c=5807&t=r&o=61

The flash controls make a call to the server for an xml document that describes what images to load into the view, this is the way heaps of flahs works nowadays and its pretty cool. http://flashden.net is a great site for flash controls with sourcecode and they are as cheap as chips.

The xml document looks like:

<content>
  <image>
    <path><![CDATA[HTTP://58.96.20.76/images/0000013285.JPG]]></path>
    <description><![CDATA[1]]></description>
    <thumbnail><![CDATA[HTTP://58.96.20.76/images/0000013285.JPG]]></thumbnail>
  </image>
  <image>
    <path><![CDATA[HTTP://58.96.20.76/images/0000013286.JPG]]></path>
    <description><![CDATA[2]]></description>
    <thumbnail><![CDATA[HTTP://58.96.20.76/images/0000013286.JPG]]></thumbnail>
  </image>
</content>

Regards
Bill Shields

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NetTalk work with Google map
« Reply #8 on: March 10, 2012, 06:02:12 PM »
I cannot find the GetWebResource function.  Where is it and how do I include it in a source procedure?

Thanks!

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: NetTalk work with Google map
« Reply #9 on: March 11, 2012, 10:05:53 PM »
Don
I think Bill mentions that it is one of his own functions.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NetTalk work with Google map
« Reply #10 on: March 12, 2012, 02:40:21 AM »
Yep...he did.  I figured out how to do this using Open Street Map ( www.openstreetmap.org ) and standard NetTalk functions.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11