Driving Script - Bug Report

439
3
07-16-2011 11:30 AM
ShaningYu
Frequent Contributor
In ArcGIS Extension for Google Maps API, the sample code: Get Driving Directions (http://help.arcgis.com/en/webapi/javascript/gmaps/samples/routetask/routetask_directions.html) appears to have some bugs.  If you runs the script w/o any change, the results look to be fine.  If change the starting address: e.g. I put 2325 Birch Log Way, Hacienda Heights, CA 91745, the results obtained:
1) Only the Start point address displays on the map, and the destination address point does not show.
2) Geocoding actually fails.
I also run several other tests.  Sometime it works but sometimes not.  I guess it is due to the failure of geocoding.  It appears to be that many addresses can not be geocoded.
0 Kudos
3 Replies
ShaningYu
Frequent Contributor
I did several more tests.  It appears to be that ESRI's geocoding service fails to work as the geocoding status displays on the top-right corner forever.  For example, I used the two valid addresses below:
3730 Allendale Circle, Pittsburgh, PA 15204
3600 Forbes Ave., Pittsburgh, PA 15261
I wish ESRI can take care of this.
0 Kudos
derekswingley1
Frequent Contributor
If you look at the source for the sample, you'll see the following:
var from_segs = document.getElementById("from_text").value.split(",");
var from_addr = { Address: from_segs[0], City: from_segs[1], State: from_segs[2], Zip: from_segs[3]};

There is similar code for the "to" address. What that means is that the sample expects addresses in a  specific format- all pieces of the address need to be comma separated. This is not ideal but it's how the geocoding/locator service used in the sample works.

If you change your addresses to "3730 Allendale Circle, Pittsburgh, PA, 15204" and "3600 Forbes Ave., Pittsburgh, PA, 15261" the sample works (although routing did takes more than a few seconds for me...).
0 Kudos
ShaningYu
Frequent Contributor
Thanks.  I did not realize a "," should be placed after State.
0 Kudos