IGNF / road2

NodeJS routing server aggregating several popular routing engines (video presentation (french) : https://peertube.fr/w/75fwFoW2GP8tQSGLUXUpPP)

Home Page:https://ignf.github.io/road2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feat] Expose native OSRM and Valhalla APIs

azarz opened this issue · comments

Feature

Expose native OSRM and Valhalla APIs

Is your feature request related to a problem? Please describe.

I would like to develop a web-based application using the maplibre-gl framework, and use the IGN routing APIs. The routing plugins available use native OSRM and Valhalla APIs to work, and I'd want to use them out of the box (https://github.com/maplibre/maplibre-gl-directions and https://github.com/watergis/mapbox-gl-valhalla)

Describe the solution you'd like

I'd like to be able to use the native APIs of OSRM and Valhalla on a road2 service (specifically, the one served by IGN).
For example :

  • osrm : {baseRoad2Url}/simple/1.0.0/osrm/driving/13.388860,52.517037;13.385983,52.496891?steps=true
  • valhalla : {baseRoad2Url}/simple/1.0.0/valhalla/isochrone?json={"locations":[{"lat":-1.0825252603106321,"lon":35.47230915879868}],"costing":"pedestrian","contours":[{"time":10,"color":"0000ff"}],"polygons":true}

Other suggestion :

  • osrm : {baseRoad2Url}/osrm/driving/13.388860,52.517037;13.385983,52.496891?steps=true
  • valhalla : {baseRoad2Url}/valhalla/isochrone?json={"locations":[{"lat":-1.0825252603106321,"lon":35.47230915879868}],"costing":"pedestrian","contours":[{"time":10,"color":"0000ff"}],"polygons":true}

Tasks

  • Create an openAPI JSON for OSRM (documentation/apis)
    • Route URL
    • GetCap URL to make the link between resources and profile/optimization
  • Create an openAPI JSON for Valhalla (documentation/apis)
    • Iso URL
    • GetCap URL to make the link between resources and profile/optimization
  • Modify the configuration to add the new APIs (docker/config/service.json)
  • Create the directories src/js/apis/osrm/1.0.0 and src/js/apis/valhalla/1.0.0
  • For each directory, code the init.js, update.js and index.js
    • For the init.js : create the getcap
    • For the update.js : update the getcap
    • For the index.js : create the router which handle requests.
  • Add new properties inside the routeRequest class to handle osrm options
  • Add new properties inside the isoRequest class to handle valhalla options
  • Add an optional option object inside the computeRequest function to indicate that we want the raw response of the motor or create two new classes for each motor responses
  • Add unit and integration tests for any new classes or properties of existing ones
  • Add request tests (test/functional/request/cucumber/features)
  • Modify the default configuration and run configuration functional tests
  • Update documentation
  • Update changelog
commented

Hello @azarz, I like this idea. I prefer the second option and I would add a version. Something like {baseRoadUrl}/osrm/{osrmVersion}/driving/.... Is that possible with your framework ?

And how could we handle resources ?

Yes this is possible, the plugin only needs the url before /driving for OSRM and before /isochrone for Valhalla, so it doesn't matter what's before those.
For the same reason, the resource should be before those parts of the urls, maybe something like :
{baseRoad2Url}/osrm/{osrmVersion}/{resource}/driving/13.388860,52.517037;13.385983,52.496891?steps=true
and
{baseRoad2Url}/valhalla/{resource}/isochrone?json={"locations":[{"lat":-1.0825252603106321,"lon":35.47230915879868}],"costing":"pedestrian","contours":[{"time":10,"color":"0000ff"}],"polygons":true}

commented

Perfect ! Let's do it !

commented

Ok for OSRM. TODO for valhalla.