[OSRM-talk] OSM Way Ids

André Siefken - geozelot siefken at geozelot.com
Wed Jul 29 17:31:27 UTC 2020


Okay, thanks again! But please bear with me here one last time:
I am looking to assign the actual OSM way id to the result object, as result.ref property (or elsewhere).
I have an understanding of how the WayHandler retrieves the tags (e.g. by key) stored as way object properties. But is the actual OSM way id attached to the way object, too, and if, how can I retrieve it?
way:get_value_by_key() seems to address tag key:value pairs stored in a map attached to the way object (but then I am not sure how the way struct is actually structured).

So, consider original OSM data:
would I be able to use way:get_value_by_key('id') to get the original (!) OSM id from a way object, or can I e.g. get it directly with way.id, or do I need to put the OSM id into the tags first to be able to retrieve it?

All the best, and thanks in advance,
André

Am 29. Juli 2020 18:45:26 MESZ schrieb Mateusz Loskot <mateusz at loskot.net>:
>On Wed, 29 Jul 2020 at 16:50, André Siefken <siefken at geozelot.com>
>wrote:
>>
>> assuming I would attempt to replace the result.ref with the actual
>way ID, how would I retrieve the actual ID from the passed in way, as
>it is no tag?
>
>Consider way_function, the way object passed in has attributes.
>Typically, those are OSM tags, but it does not have to be OSM tag.
>For example, you can preprocess non-OSM data into PBF to make it look
>& feel like OSM in order to let OSRM digest it.
>You can assign your nodes and ways with `ref` identifiers of your own
>scheme, it does not have to be OSM identifiers.
>
>Moreover, whatever properties are attached to way objects, you can
>access them inside lua profiles
>
>local way_i = way:get_value_by_key('this_is_my_custom_way_id)
>local way_n = way:get_value_by_key('this_is_my_custom_way_name)
>
>result.name = way_n
>result.ref = way_i
>result...
>
>> Can I use property notation like way.id or similar
>
>result.ref
>
>but the value can be based on a custom scheme, it does not have to be
>OSM identifiers.
>
>See also
>https://www.winwaed.com/blog/2015/11/18/osrms-lua-scripts/
>https://github.com/Project-OSRM/osrm-backend/blob/master/docs/profiles.md
>The last one is a bit out of date w.r.t. Lua fuction names.
>
>Best regards,
>-- 
>Mateusz Loskot, http://mateusz.loskot.net
>
>_______________________________________________
>OSRM-talk mailing list
>OSRM-talk at openstreetmap.org
>https://lists.openstreetmap.org/listinfo/osrm-talk

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20200729/17d7344c/attachment.htm>


More information about the OSRM-talk mailing list