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

    Thanks
     
    tamaker, Apr 27, 2009
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed tamaker <>
    writing in news:69bb6f7b-a30f-4667-8813-
    :

    > 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

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Apr 27, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    285
    Marcus Kwok
    Jan 9, 2006
  2. Replies:
    0
    Views:
    278
  3. jliu66
    Replies:
    0
    Views:
    520
    jliu66
    Oct 19, 2007
  4. VP
    Replies:
    2
    Views:
    434
  5. Li Chen
    Replies:
    18
    Views:
    672
    Azmi Farih
    Mar 23, 2010
Loading...

Share This Page