extracting / using values from a returned CSV string

T

tamaker

Anyone have an example or knowledge of a .ASP tutorial that will show
me how to take the CSV response from googles geocoding service and use
the lat and long values individually? (i.e. var1= that lattitude and
var 2 = the longitude?)

Thanks
 
A

Adrienne Boswell

Gazing into my crystal ball I observed tamaker <[email protected]>
writing in (e-mail address removed):
Anyone have an example or knowledge of a .ASP tutorial that will show
me how to take the CSV response from googles geocoding service and use
the lat and long values individually? (i.e. var1= that lattitude and
var 2 = the longitude?)

Thanks

It comes in as an XML response that you can put into an array and get the
values from the array.

Dim objXMLHTTP, xml
Dim myaddress, mycity, mystate_abbr, mygeokey
Dim longitude, latitude
Dim

' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

' Opens the connection to the remote server.
xml.Open "GET", "http://maps.google.com/maps/geo?q=" & server.urlencode
(myaddress) & ",+" & server.urlencode(mycity) & ",+" & server.urlencode
(mystate_abbr) & "&output=csv&sensor=false&key=" & mygeokey, False

' Actually Sends the request and returns the data:
xml.Send

'Display the HTML both as HTML and as text
Response.Write "<h1>The HTML text</h1><xmp>"
Response.Write xml.responseText & "<br />"
geoarr = split(xml.responseText,",")
latitude = geoarr(2)
longitude = geoarr(3)
response.write "latitude: " & geoarr(2) & " longitude: " & geoarr(3)
Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"
Response.Write xml.responseText

Set xml = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top