Osrm-backend: Get OSM_ID from Match Service

Created on 28 May 2019  路  1Comment  路  Source: Project-OSRM/osrm-backend

I know there have been many questions about how to get "osm_id" from the match service.

However, there is no clear answer. Anybody says "just add 'annotations=true' then you can get the node_id ..."

I think the they are looking into other data. (question - geofabrik, gis_osm_roads_free_1.shp // answer - open street map API )

What I want to know is how to map geofabrik's osm_id to open street map node id.

I apply map-match to gps data, to count how many cars are on the road which is based on osm_id

I think I can do it just by using match-service with annotation options... If i understand how to map geofabrik's osm_id to open street map node id

Any Brilliant suggestions?

Most helpful comment

@niceguy1575 You may want to read up on OpenStreetMaps data model here: https://wiki.openstreetmap.org/wiki/Elements

In OSM, lines are called "ways", and they have an ID. Ways connect nodes together, and those nodes have IDs too.

OSRM stores and returns the node IDs along a path, because they map directly to coordinates. OSRM does not store way IDs, because there is a many-to-many mapping between OSRM's concept of routable edges, and OSMs way IDs. Storing a many-to-many data structure has so far been deemed more effort than its worth - the uses of way ids for routing are pretty limited.

What you can do is add annotations=nodes to your query, then pass that node list to something like:

https://github.com/mapbox/route-annotator

which will return the way IDs of the ways that the path touches. I suspect this is what you want.

>All comments

@niceguy1575 You may want to read up on OpenStreetMaps data model here: https://wiki.openstreetmap.org/wiki/Elements

In OSM, lines are called "ways", and they have an ID. Ways connect nodes together, and those nodes have IDs too.

OSRM stores and returns the node IDs along a path, because they map directly to coordinates. OSRM does not store way IDs, because there is a many-to-many mapping between OSRM's concept of routable edges, and OSMs way IDs. Storing a many-to-many data structure has so far been deemed more effort than its worth - the uses of way ids for routing are pretty limited.

What you can do is add annotations=nodes to your query, then pass that node list to something like:

https://github.com/mapbox/route-annotator

which will return the way IDs of the ways that the path touches. I suspect this is what you want.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bardo-Konrad picture Bardo-Konrad  路  3Comments

ltsstar picture ltsstar  路  5Comments

Oyabi picture Oyabi  路  5Comments

brunosan picture brunosan  路  5Comments

Eichenherz picture Eichenherz  路  4Comments