ffwdme / ffwdme.js

[DEPRECATED!] 🛑 A JavaScript toolkit that aims to bring interactive GPS driving directions to the mobile browser
http://ffwdmejs.org
MIT License
153 stars 36 forks source link

Support for ESRI routing services #20

Closed jptheripper closed 8 years ago

jptheripper commented 8 years ago

I would love to integrate ffwdme into my ESRI application, have you considered offering support for ESRI routing services?

fabrik42 commented 8 years ago

Hi, I never used the ESRI services myself, but I should be possible. The easiest way would be to subclass the Routing base class: https://github.com/ffwdme/ffwdme.js/blob/master/src/core/routing/base.js

To meet the interface, one would need to implement the fetch method that asynchronously either calls the error or success method. (like here https://github.com/ffwdme/ffwdme.js/blob/master/src/core/routing/graph_hopper.js#L145)

The successcallback needs an instance of the ffwdme.Route class, so the second step would be to parse the response of the ESRI server into a route object.

I don't have access to an ESRI server, but if you want to give it a shot, I would be glad to help you get it going.

Cheers, Christian

jptheripper commented 8 years ago

Oh that would be great

Here is a two stop example of a route request to esri

http://www.mymanatee.org/arcgis02/rest/services/routing/routing/NAServer/Route/solve?f=pjson&returnDirections=true&returnRoutes=false&returnZ=true&returnStops=true&returnBarriers=false&returnPolygonBarriers=false&returnPolylineBarriers=false&outSR=102100&outputLines=esriNAOutputLineTrueShape&findBestSequence=false&preserveFirstStop=true&preserveLastStop=true&ignoreInvalidLocations=true&directionsLanguage=en&directionsLengthUnits=esriNAUMiles&travelMode=null&stops=%7B%22type%22%3A%22features%22%2C%22features%22%3A%5B%7B%22geometry%22%3A%7B%22x%22%3A-9192219.621595858%2C%22y%22%3A3184350.7274418115%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%2C%22attributes%22%3A%7B%22address%22%3A%221431%2014th%20St%20W%22%2C%22Status%22%3A0%2C%22SourceID%22%3Anull%2C%22SourceOID%22%3Anull%2C%22PosAlong%22%3Anull%2C%22SideOfEdge%22%3Anull%7D%7D%2C%7B%22geometry%22%3A%7B%22x%22%3A-9193640.872590574%2C%22y%22%3A3184866.67738275%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%2C%22attributes%22%3A%7B%22address%22%3A%222608%2011th%20Ave%20W%22%2C%22Status%22%3A0%2C%22SourceID%22%3Anull%2C%22SourceOID%22%3Anull%2C%22PosAlong%22%3Anull%2C%22SideOfEdge%22%3Anull%7D%7D%5D%2C%22doNotLocateOnRestrictedElements%22%3Atrue%7D&directionsOutputType=esriDOTComplete

fabrik42 commented 8 years ago

This link gives me a 502/Page not found error.

fabrik42 commented 8 years ago

I will close this issue until I can get more information on the topic.