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

Support for road id #1605

Closed
leandropls opened this issue Aug 18, 2015 · 8 comments
Closed

Support for road id #1605

leandropls opened this issue Aug 18, 2015 · 8 comments

Comments

@leandropls
Copy link

When querying for a route, sometimes the origin or destination is in a location that has multiple streets running above each other going to different places. If known, It would be very useful to be able to inform OSRM which one the vehicle is in.

Maybe we could inform osm_ids to complement the coordinates?

@danpat
Copy link
Member

danpat commented Aug 18, 2015

The typical way to do this is to encode the ID in the "name" value here:

https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua#L334-L353

and then parse the ID out of the name field when you display the data for the user. The problem with explicitly adding an ID to the internal data structure is that it will increase memory usage quite a lot.

@leandropls
Copy link
Author

That sure does help when parsing the output of OSRM, your tip will indeed help me. Thanks!

But how do you differentiate overlapping streets on an input?

@danpat
Copy link
Member

danpat commented Aug 18, 2015

What do you mean by that? Can you point to an example in OSM?

@leandropls
Copy link
Author

Here it is:
http://www.openstreetmap.org/#map=16/-22.9207/-43.2111

Via Elevada Engenheiro Freyssinet (Elevated Way Engineer Freyssinnet) runs above Avenida Paulo de Frontin (Paulo de Frontin Avenue). The difference in their position isn't expressed in terms of lng, lat, but height.

Here is a view of it on Google Street View:
https://www.google.com.br/maps/@-22.918975,-43.2101666,3a,90y,75.17h,81.37t/data=!3m6!1e1!3m4!1sy78CWIiN3DTIj-4gRl_V6Q!2e0!7i13312!8i6656

@danpat
Copy link
Member

danpat commented Aug 18, 2015

Visually those roads may overlap, but in OSM, they're modeled as separate ways, so there will be no problem routing on them or getting them confused.

@leandropls
Copy link
Author

I understand that there is no problem in routing through them. My point is than given a (lng, lat) of them as origin/destination, OSRM might choose to select any of the two roads to use as origin/destination, since the (lng, lat) pair isn't enough to tell them apart. Does that make sense?

@danpat
Copy link
Member

danpat commented Aug 18, 2015

OSRM uses a "nearest neighbor" method to find the closest spot to the requested routing point.

There is no good linear referencing method for OSM right now, and even if there was one, it would be difficult for the user to enter the data properly when compared to dropping a location marker.

Practically, it's not easy to draw ways directly one on top of the other, so you'll probably find that you will be able to get the pin on the correct road with a little bit of adjusting.

OSRM also has a "map-matching" plug in which uses a Hidden-Markov model to match a GPS trace to the most likely route. If you're trying to snap location coordinates to the correct road, you should use the map-matching plugin, it does a pretty good job of selecting the real route if you give it enough points to work with.

@leandropls
Copy link
Author

Alright, thanks.

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