Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating OSRM routing #24

Closed
ravl1084 opened this issue Apr 20, 2017 · 2 comments
Closed

Updating OSRM routing #24

ravl1084 opened this issue Apr 20, 2017 · 2 comments

Comments

@ravl1084
Copy link

Hi,

I've put together a Python script to query OSRM and then produce a GPX out of the GeoJSON ( who uses GeoJSON??) response.

I see that in the Viking preferences there is a dropdown to select a routing engine but only the default OSRM is available as a choice. Is there a way for me to add a new routing service?

@rnorris
Copy link
Collaborator

rnorris commented Apr 21, 2017

You can specify alternative routing engines via a configuration file ~/.viking/routing.xml
Hopefully the manual explains how to do this, with some lines like:

<objects>
  <!-- Note that OSRM no longer supports GPX output -->
  <object class="VikRoutingWebEngine">
    <property name="id">osrm</property>
    <property name="label">OSRM</property>
    <property name="format">geojson</property>
    <property name="url-base">http://router.project-osrm.org/viaroute?output=geojson</property>
    <property name="url-start-ll">&amp;loc=%s,%s</property>
    <property name="url-stop-ll">&amp;loc=%s,%s</property>
    <property name="url-via-ll">&amp;loc=%s,%s</property>
  </object>
</objects>

However you I don't think there's a way to run your program between Viking's request and the processing of the response, other than replacing the GPSBabel binary with your program

I note the latest (only in the source code git repository - so not in a release yet) GPSBabel now has capability to read GeoJSON, so you may be better off investigating that.
When the 'format' property above is anything else than 'gpx', Viking will attempt to use GPSBabel to translate the result into GPX for Viking to use.

PS The last time I looked at OSRM I thought it returned it's own bespoke JSON schema, not GeoJSON, but I could be wrong.
NB Viking can load GeoJSON files if the program togpx (from https://www.npmjs.org/package/togpx) is available on the system, but only via Acquire->Import GeoJSON File... menu.

HTH

@ravl1084
Copy link
Author

Thanks for the response! I tried GPSBabel 1.5.4 and I only get an empty GPX shell. While I was fiddling with the OSRM call, I did notice that the resulting JSON varies significantly depending on the parameters you pass, so it may not be pure GeoJSON.
I think I'll just keep using my script as a separate utility and load the GPXs into Viking.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants