openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.17k stars 911 forks source link

Allow exporting direction path tracks #5224

Open jidanni opened 1 week ago

jidanni commented 1 week ago

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

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 commented 1 week ago

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:

tomhughes commented 1 week ago

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

jidanni commented 1 week ago

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 commented 6 days ago

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 commented 5 days ago

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

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.