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

Allow exporting direction path tracks #5224

Open
2 tasks
jidanni opened this issue Sep 19, 2024 · 5 comments
Open
2 tasks

Allow exporting direction path tracks #5224

jidanni opened this issue Sep 19, 2024 · 5 comments

Comments

@jidanni
Copy link

jidanni commented Sep 19, 2024

Problem

Directions tracks are great,

https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=24.18978%2C120.86377%3B24.18252%2C120.86482

But the website needs to provide a free and open export method, like

  • Export track to GPX
  • Export track to KML

else the direction tracks are merely one more proprietary solution, requiring the user to reverse-engineer the internal communications with the browser, if the user wishes to export the path:

Internal communication interception (via DevTools):

Request URL:
https://routing.openstreetmap.de/routed-car/route/v1/driving/120.8648163,24.1825192;120.863771,24.189783?overview=false&geometries=polyline&steps=true&hints=t8PogbGSCYcCAAAAUAAAAAAAAAAAAAAAAppJQMyWr0IAAAAAAAAAAAIAAABQAAAAAAAAAAAAAAAiQQAAGzw0B34bcQEbPDQHVxtxAQAA7xBkH6V2%3...

So the user must employ a polyline decoder, or SVG analyzer...
https://stackoverflow.com/questions/32476218/how-to-decode-encoded-polylines-from-osrm-and-plotting-route-geometry

Well all I got were sections of the equator. So I'll just give up trying to reverse engineer it.

Probably end up using Google,
https://gis.stackexchange.com/questions/152571/export-google-maps-route-to-kml-gpx

@mmd-osm
Copy link
Contributor

mmd-osm commented Sep 19, 2024

I don't think it makes a whole lot of sense to reimplement the GPX export for 3 different routing engines. However, it might be a better idea to add some links underneath the direction results which point to the respective engine demo pages.

These pages anyway have much more capabilities, like supporting additional waypoints. And more importantly, they also come with either GPX or GeoJSON export out of the box.

Example links:

  • https://graphhopper.com/maps/?point=24.18978%2C120.86377_24.18978%2C+120.86377&point=24.18252%2C120.86482_24.18252%2C+120.86482&profile=hike&layer=Omniscale or a bit simplified https://graphhopper.com/maps/?point=24.18978%2C120.86377&point=24.18252%2C120.86482&profile=hike
  • https://valhalla.openstreetmap.de/directions?profile=pedestrian&wps=120.8635823%2C24.1893169%2C120.8648163%2C24.1825192
  • https://routing.openstreetmap.de/?z=17&center=24.188205%2C120.858920&loc=24.189317%2C120.863582&loc=24.182519%2C120.864816&hl=en&alt=0&srv=2 or simplified as https://routing.openstreetmap.de/?loc=24.189317%2C120.863582&loc=24.182519%2C120.864816&srv=2

@tomhughes
Copy link
Member

Is there a valid editing use case for this? It sounds like an end-user feature request to me?

@jidanni
Copy link
Author

jidanni commented Sep 20, 2024

It's the difference between being a closed source and open source website.
@mmd-osm's suggestion would allow the OSM website to keep fully open.
Yes, it's not exactly source code in this case, but source data. Same thing.

@AntonKhorev
Copy link
Collaborator

Is there a valid editing use case for this?

For links to routing engines I guess it's the same as with Nominatim, which we have. Hopefully they provide more information about why the route was build this way.

For exporting from the osm website, you can use the trace as a guide for downloading areas in Josm for example. I'm doing something similar with notes my note viewer to generate a "path" of consecutive notes.

@mmd-osm
Copy link
Contributor

mmd-osm commented Sep 21, 2024

I have updated the example URLs from above to only require start lat/lon and end lat/lon values as well as a profile.

  • Valhalla: https://valhalla.openstreetmap.de/directions?profile=pedestrian&wps=120.8635823%2C24.1893169%2C120.8648163%2C24.1825192
  • OSRM: https://routing.openstreetmap.de/?loc=24.189317%2C120.863582&loc=24.182519%2C120.864816&srv=2
  • GraphHopper: https://graphhopper.com/maps/?point=24.18978%2C120.86377&point=24.18252%2C120.86482&profile=foot

For the profile values, I'd suggest the following mapping table:

  Car Bicycle Foot
Valhalla car bicycle pedestrian
OSRM 0 1 2
GraphHopper car bike foot

OSRM (FOSSGIS) is a bit special, since the values appear to be derived from the sequence in https://github.com/fossgis-routing-server/cbf-routing-profiles/blob/master/profiles.conf.example#L2 ... the profile values are valid for the FOSSGIS instance only.

I think that's probably all we need to generate URLs similar to Nominatim.

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

4 participants