WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Google Earth

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Latitude and Longitude of Address

 Keywords:  Latitude Longitude Address Google Earth COM API GetResults GetCamera FocusPointLatitude FocusPointLongitude

Question:

I would like to retrieve the Latitude and Longitude a particular address using Google Earth. How can thiis be accomplished in WinBatch?

Answer:

First download and install Google Earth. http://earth.google.com/download-earth.html

The following code uses the Google Earth COM API to get the latitude and longitude a particular address.

objGE = CreateObject("GoogleEarth.ApplicationGE")
While @TRUE
If objGE.IsInitialized()  && objGE.IsOnline() Then Break
EndWhile
dblAPo = objGE.AutoPilotSpeed
objGE.AutoPilotSpeed = 5

objSC = CreateObject("GoogleEarth.SearchcontrollerGE")
objSC.ClearResults ()
TimeDelay(1)
objSC.Search("5421 California Ave SW, Seattle, Wa 98136")
While objSC.IsSearchInProgress
    TimeDelay(1)
EndWhile

;feature Collection
objFC = objSC.GetResults
For i = 1 To objFC.Count
   Name = objFC.Item(i).Name
   objFChild = objFC.item(i).GetChildren
   For j = 1 To objFChild.Count
        Pause("Child", objFChild.Item(j).Name )
   Next

   ;Get latitude and Longitude
   camPos = objGE.GetCamera(0)
   LAT = camPos.FocusPointLatitude
   LONG =  camPos.FocusPointLongitude
   Pause( Name, 'LAT: ' : LAT : @CRLF : 'LONG: ': LONG)
Next


objGE = 0
objSC = 0
Exit

Article ID:   W18122
Filename:   Get Latitude and Longitude of Address.txt
File Created: 2009:02:18:09:42:44
Last Updated: 2009:02:18:09:42:44