Thursday, January 31, 2013

Geocoding Question

I have an ASP script that takes a zip code and derives latitude/longitude coordinates. As you can see it is a simple integration. With such an integration I am allowed 2500 queries per day. I am going over that and would like to convert it to where I am using API credentials. I have looked and looked and cannot figure this one out. I know it is simple but just cannot find any code or a solution. 

Here is the existing code. I am passing a five (5) digit zip code into this ASP sub-routine.

Sub getLatLon(vAddress,latitude,longitude)        
                
        Set xmlhttp = Server.Createobject("MSXML2.ServerXMLHTTP")
' create url to post
urlToPost = "http://maps.googleapis.com/maps/api/geocode/xml?address=" & vAddress & ""
xmlhttp.Open "POST",urlToPost, false
        xmlhttp.Send
        strRetval = xmlhttp.ResponseText
        
        print "xmlhttp.ResponseText:" & xmlhttp.ResponseText & br
        
        Set xmlhttp = nothing

       Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
       objXMLDoc.async = False 
       objXMLDoc.loadXML(strRetval) 
       
       Set lat = objXMLDoc.documentElement.selectSingleNode("//lat")
       latitude = lat.Text
       Set lon = objXMLDoc.documentElement.selectSingleNode("//lng")
       longitude = lon.Text
End Sub
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment