I have been running a spreadsheet that knows how to convert an address to Latitude and Longitude values.
It uses a yahoo MapsService.
For some unknown reason, it has stopped working. I went back to a previous version of the program and the same negative result.
Below is the core section of the code. Might it be that they discontinued this API???
the lsXXX variables contain the Street, city, state and Zip data
For some reason, the http address does not show completely in the code section (spaces added to prevent clickable link)
lsURLInfo = http : // api.local.yahoo.com/MapsService/V1/geocode?appid=TestGeoCode= ....
I placed "error locators" in the code and it fails trying to execute :
lsLatitude = lobjXmlDoc.documentElement.selectSingleNode("Result/Latitude").Text
Here is the code
I tried the following in a web browser using my zipcode (again added spaces to prevent clickable link)
http : // api.local.yahoo.com/MapsService/V1/geocode?appid=TestGeoCode&Zip=48322
It returned a rather nasty (useless?) message
<?xml version="1.0" encoding="UTF-8" ?>
- <Error xmlns="urn:yahoo:api">
The following errors were detected:
<Message>backend fetch error 403</< font>Message>
</< font>Error>
Any advice greatly appreciated
Thanks
It uses a yahoo MapsService.
For some unknown reason, it has stopped working. I went back to a previous version of the program and the same negative result.
Below is the core section of the code. Might it be that they discontinued this API???
the lsXXX variables contain the Street, city, state and Zip data
For some reason, the http address does not show completely in the code section (spaces added to prevent clickable link)
lsURLInfo = http : // api.local.yahoo.com/MapsService/V1/geocode?appid=TestGeoCode= ....
I placed "error locators" in the code and it fails trying to execute :
lsLatitude = lobjXmlDoc.documentElement.selectSingleNode("Result/Latitude").Text
Here is the code
Code:
Dim XMLhttp
Dim lsURLInfo
Dim lsTechAuthString
lsURLInfo = "[URL]http://api.local.yahoo.com/MapsService/V1/geocode?appid=TestGeoCode&street[/URL]=" & lsStreet & "&city=" & lsCity & "&state=" & lsState & "&zip=" & lsZip
Set XMLhttp = CreateObject("MSXML2.ServerXMLHTTP")
XMLhttp.Open "GET", lsURLInfo, False
XMLhttp.setRequestHeader "Content-Type", "text/xml"
XMLhttp.send StringVal
lsTechAuthString = XMLhttp.responseText
Set XMLhttp = Nothing
Set lobjXmlDoc = CreateObject("Microsoft.XMLDOM")
lobjXmlDoc.Async = False
lobjXmlDoc.loadXML (lsTechAuthString)
If lobjXmlDoc.parseError.errorCode <> 0 Then
' Error Reading XML Document
lsResult = "Parse Error - Retry Transmission"
lsMessage = lobjXmlDoc.parseError.errorCode & " - " & lobjXmlDoc.parseError.reason & " - " & lobjXmlDoc.parseError.Line
Else
' Retrieve relevant information from API - XML document
' ????????? PROGRAM ERROR OUT ON THE NEXT STATEMENT ???????
lsLatitude = lobjXmlDoc.documentElement.selectSingleNode("Result/Latitude").Text
lsLongitude = lobjXmlDoc.documentElement.selectSingleNode("Result/Longitude").Text
End If
I tried the following in a web browser using my zipcode (again added spaces to prevent clickable link)
http : // api.local.yahoo.com/MapsService/V1/geocode?appid=TestGeoCode&Zip=48322
It returned a rather nasty (useless?) message
<?xml version="1.0" encoding="UTF-8" ?>
- <Error xmlns="urn:yahoo:api">
The following errors were detected:
<Message>backend fetch error 403</< font>Message>
</< font>Error>
Any advice greatly appreciated
Thanks