I'm trying to build a webmap application using the ArcGIS JavaScript API. A functionality I would like to include is driving directions from a current GPS location to a feature in my feature service.
I don't want to use Esri's ArcGIS Online service because it consumes credits. I created a geoprocessing routing service which is hosted in ArcGIS for Server, but getting it to work has a whole other set of complications. My last resort is to try and use a driving directions API like that provided by Mapquest.
Is there a way to incorporate this type of API in an ArcGIS JavaScript API, and if so, how?
-
1Getting this to work would be one matter - ensuring that it's legal would be a whole separate issue. You should carefully read the MapQuest terms of service which states You may not commercially exploit the Materials or the underlying data... you may not create derivative works of the MaterialsStephen Lead– Stephen Lead2014年07月14日 04:02:46 +00:00Commented Jul 14, 2014 at 4:02
-
seems like a lot of extra trouble since you can generate 15,000 simple routes a year with a free developers.arcgis.com account (50 complimentary credits per month)john gravois– john gravois2014年07月18日 19:06:10 +00:00Commented Jul 18, 2014 at 19:06
1 Answer 1
You can use the MapQuest Open Directions API Web Service This
... allows you to use OpenStreetMap (OSM) routing data directly over HTTP without having to go through a language-specific SDK. Requests can be submitted as Key-Value pairs, JSON, XML and more.
If you look at the API, you can find several samples. The service can return results which includes the latitude & longitude of the points on the route, road names, directions and other information about the route.
You can make the AJAX request from your App, and once you get the result, you can draw that as graphics on your map.
There are no ready-made objects in the ESRI JSAPI for this, so you'll have to write some custom code to parse the results, and show the results on the map.
Explore related questions
See similar questions with these tags.