Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.45k stars 3.42k forks source link

Side of road #6485

Closed JohnMartin10000 closed 4 months ago

JohnMartin10000 commented 1 year ago

How I can set side of road for planned route?

I looked for any solution but I only see some mentions about approach=curb, but this is not what I wont, I just have to set left or right side.

danpat commented 1 year ago

You need to align a few things:

  1. When you process the data, make sure you use the file in data/driving_side.geojson - pass it to osrm-extract --location-dependent-data data/driving_side.geojson ... - this will ensure that all edges are properly marked with the correct driving side for each country.
  2. Use approach=curb in your requests.
  3. Make sure your input coordinate is set slightly off to the side of the road geometry your destination is actually on.

You said:

I just have to set left or right side

but this does not make sense - there is no absolute "left" or "right" side of any road, it depends on the direction you are traveling along that road.

Point (3) above may be your main challenge - it will depend where you are getting your destination coordinates from - are you dropping markers on the map, or depending on a geocoding service to perform address-to-coordinate conversion?

kabilsharma commented 1 year ago

We are building our own data on top of osrm. dumped geojson and converted with ogr2osm and osmosis to make it osrm friendly. set left_drive true in car.lua added drive_direction = left in database. still when build with osrm it is taking right hand driving. wanted to try location dependent data approach. downloaded india admistrative from overpass. throwing location out of index. what can i do more? where i could find driving_side.geojson?

danpat commented 1 year ago

@kabilsharma You need to provide some more detail, perhaps a screenshot showing examples?

The left-hand-driving flags in the processing files mostly only impact results when you use approaches=curb - otherwise, most roads are singly digitized and allow travel in both directions, doubly-digitized roads should be marked as one-way, and roundabouts also should have the appropriate oneway flag set. For roads like motorways with assumed oneway=yes flags, you must ensure the geometry/nodes are ordered in the direction of travel (or if they're not, supply oneway=-1 for reversed roads).

I think you probably need to step carefully through your GeoJSON->OSM data and ensure that you're generating the map you think you're generating.

There is a driving_side.geojson file in the data directory here: https://github.com/Project-OSRM/osrm-backend/tree/master/data - but it sounds like your issues may be more fundamental. Again, the driving-side flag mostly only impacts approaches=curb.

kabilsharma commented 1 year ago

Thanks Danpat for prompt reply. Yes it was a mistake at my end it was drawing left hand routes just oneway tags in data were yes and no instead of Yes or no ( roundabout a well) . It worked

AtharvaShekatkar commented 1 year ago

You need to align a few things:

  1. When you process the data, make sure you use the file in data/driving_side.geojson - pass it to osrm-extract --location-dependent-data data/driving_side.geojson ... - this will ensure that all edges are properly marked with the correct driving side for each country.
  2. Use approach=curb in your requests.
  3. Make sure your input coordinate is set slightly off to the side of the road geometry your destination is actually on.

You said:

I just have to set left or right side

but this does not make sense - there is no absolute "left" or "right" side of any road, it depends on the direction you are traveling along that road.

Point (3) above may be your main challenge - it will depend where you are getting your destination coordinates from - are you dropping markers on the map, or depending on a geocoding service to perform address-to-coordinate conversion?

Do we need to pass driving_side.geojson only for osrm-extract or also for osrm-partition and osrm-customize?

SiarheiFedartsou commented 4 months ago

Stale.