Project-OSRM / osrm-backend

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

Exact points routing #1473

Closed Guipa closed 8 years ago

Guipa commented 9 years ago

Hi,

Is there a way to do a routing (car profile) from exact coordinates to exact coordinates (with no phantom nodes) ? In other words, can osrm calculate a route strictly from point A to Point B. If coordinates of point A and point B are not those of existing nodes then we would like OSRM not to give us a route.

Is there a way to do that ? (we already try with the z parameter but no effect. So I guess it has to be modified in the code).

Thanks for any help

emiltin commented 9 years ago

You could use the locate() API (see https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-locate) to first check if your coordinates matches osm nodes. If they do use the normal viaroute() API. You could also just use the normal viaroute() API and then check if the start and end points match your coordinates.

Guipa commented 9 years ago

Hi Emil,

In fact, in my osm file, I have a node with these coordinates : 48.5781129,-3.8326438. This node is the first point of a way tagged highway=motorway_link When I do a viaroute, with these coordinates as a starting point, I have a route with not so much sense.

When I do a locate on this coordinates, I obtain 48.578114, -3.832643. These coordinates do not correspond to any node contained in my osm. It looks like a phantom node created by OSRM.

Is there a way to avoid OSRM to create such phantom nodes ?

We would like OSRM just to follow the ways with the node of the osm file …

Thanks for your help

Le 14 mai 2015 à 10:10, Emil Tin notifications@github.com a écrit :

You could use the locate() API (see https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-locate https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-locate) to first check if your coordinates matches osm nodes. If they do use the normal viaroute() API. You could also just use the normal viaroute() API and then check if the start and end points match your coordinates.

— Reply to this email directly or view it on GitHub https://github.com/Project-OSRM/osrm-backend/issues/1473#issuecomment-101964873.

woodbri commented 9 years ago

On 5/14/2015 4:10 AM, Emil Tin wrote:

You could use the locate() API (see https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-locate) to first check if your coordinates matches osm nodes. If they do use the normal viaroute() API. You could also just use the normal viaroute() API and then check if the start and end points match your coordinates.

I believe that the user points are projected onto an edge to create a virtual node and then the routing is done from the virtual nodes.

The locate API will return the location of the virtual node what may be between two physical nodes. Matching the start and end points with the original nodes will only tell you if the original nodes were positioned exactly over an edge such that the original node is equal to the virtual node.

Unless I'm totally off base on how this works in OSRM, I do not think there is any way to check this or to determine the closest actual node without adding a new API function.

-Steve

Guipa commented 9 years ago

Hi Steve,

Thanks for your response. It ’s too bad we can’t avoid creation of virtual nodes … routing could be strictly exact if it was possible. Any idea how far (distance) should a starting node be from other nodes to avoid virtual node ?

Thanks again

Le 14 mai 2015 à 16:00, Stephen Woodbridge notifications@github.com a écrit :

On 5/14/2015 4:10 AM, Emil Tin wrote:

You could use the locate() API (see https://github.com/Project-OSRM/osrm-backend/wiki/Server-api#service-locate) to first check if your coordinates matches osm nodes. If they do use the normal viaroute() API. You could also just use the normal viaroute() API and then check if the start and end points match your coordinates.

I believe that the user points are projected onto an edge to create a virtual node and then the routing is done from the virtual nodes.

The locate API will return the location of the virtual node what may be between two physical nodes. Matching the start and end points with the original nodes will only tell you if the original nodes were positioned exactly over an edge such that the original node is equal to the virtual node.

Unless I'm totally off base on how this works in OSRM, I do not think there is any way to check this or to determine the closest actual node without adding a new API function.

-Steve — Reply to this email directly or view it on GitHub https://github.com/Project-OSRM/osrm-backend/issues/1473#issuecomment-102045720.

emiltin commented 9 years ago

I though locate returns the nearest osm node (it seem to say so in the wiki) but I could be wrong.

Guipa commented 9 years ago

Yes, you are right. I think, the way to avoid virtual nodes creation (or limiting to a max distance) maybe could be set in :

boost::program_options::value(&max_locations_distance_table)->default_value(100), "Max. locations supported in distance table query")( "max-matching-size,m »,

What do you think ?

Le 14 mai 2015 à 18:02, Emil Tin notifications@github.com a écrit :

I though locate returns the nearest osm node (it seem to say so in the wiki) but I could be wrong.

— Reply to this email directly or view it on GitHub https://github.com/Project-OSRM/osrm-backend/issues/1473#issuecomment-102084780.

woodbri commented 9 years ago

ok, good to know. I was always a little confused about locate and nearest and this clears that up. Thanks.

daniel-j-h commented 8 years ago

The locate service is gone by now as it would have required great effort in the static rtree code. The nearest service is still there, but returns the nearest routable segment.