I have just been faced with a similar problem, however all my
addresses were stored in xml.
All i did is wrote the small application that loops through the
records 1 by one and shoots a geocoding request to maps.google.com
which intact responds with Lon/lat.
I then capture it and store it in a separate column.
You can also just do the same at a runtime. It's up to you.
Here is a quick snippet from my code:
'Function that takes in the address and returns Lat/Long as a string
Public Function fGeoCode(ByVal tmpIn As String) As String
'This is your API code
'would be better as a DNN Setting
Dim tmpKey As String =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Dim tmpLatLong As String = "0,0"
'Formatting the query sting to Google standards. Replacing
spaces
with plus. Not neccesary, but helps
Dim url As String = "http://maps.google.com/maps/geo?q=" &
Replace(tmpIn, " ", "+") & "&output=xml&key=" & tmpKey
Dim request As HttpWebRequest = WebRequest.Create(url)
Dim response As HttpWebResponse = request.GetResponse
'If status = 200 (OK), then load it up
If response.StatusCode = HttpStatusCode.OK Then
Dim reader As New IO.StreamReader
(response.GetResponseStream())
Dim doc As New XmlDocument()
doc.Load(reader)
'the status returned in the XML also needs to be 200
'this is different from an HTTP status code
'it tells if the geocoding was sucessful
If doc.ChildNodes.Item(1).ChildNodes.Item
(0).ChildNodes.Item(1).ChildNodes.Item(0).InnerText = "200" Then
'go straight to the XML for the Lat/long
tmpLatLong = doc.ChildNodes.Item(1).ChildNodes.Item
(0).ChildNodes.Item(2).ChildNodes.Item(3).InnerText
End If
reader.Close()
reader = Nothing
Else
'status is not 200(OK), set LatLong to 0,0
tmpLatLong = "0,0"
End If
'Returning the Lat/Long in a string
Return tmpLatLong
End Function
Hope this helps!
Nick
On Apr 7, 7:09 am, [email protected] wrote:
> seehttp://groups.google.com/group/Google-Maps-API/web/resources-non-goog...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---