extracting / using values from a returned CSV string

Discussion in 'ASP General' started by tamaker, Apr 27, 2009.

  1. tamaker

    tamaker Guest

    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?)

    tamaker, Apr 27, 2009
    1. Advertisements

  2. Gazing into my crystal ball I observed tamaker <>
    writing in :
    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

    ' 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:

    '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
    Adrienne Boswell, Apr 27, 2009
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.