Re: [OSRM-talk] OSM Way Ids
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 : >On Wed, 29 Jul 2020 at 16:50, André Siefken >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@openstreetmap.org >https://lists.openstreetmap.org/listinfo/osrm-talk -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] OSM Way Ids
On Wed, 29 Jul 2020 at 16:50, André Siefken 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@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] OSM Way Ids
Hi Mateusz, hi @all, thanks a lot, that does sound promising. I know you said it's been a while, but you may have a better idea still about two things: * 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? Can I use property notation like way.id or similar? I can't seem to find a function, or any other attempt to access a first level property other than tags, but I may have missed it. * can I simply add items to the result object (i.e. result.id), or would they not get piped through to the actual output result set, or even error out? (I couldn't get my hands on my machine until just now, thus my asking before trying) All the best, André On 7/27/20 5:45 PM, Mateusz Loskot wrote: > On Mon, 27 Jul 2020 at 11:43, André Siefken wrote: >> Can I easily change the tag selection, somewhere in the code (and rebuild), >> to fetch the way ID instead? Or is there even are profile setting for this? > It's been a while, but try to customise the Lua profile scripts > assigning custom properties to `result` created in node_function > and way_function. > > Best regards, -- pgp-key attached 0x0024705C4FC20AF6.asc Description: application/pgp-keys ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] OSM Way Ids
On Mon, 27 Jul 2020 at 11:43, André Siefken wrote: > > Can I easily change the tag selection, somewhere in the code (and rebuild), > to fetch the way ID instead? Or is there even are profile setting for this? It's been a while, but try to customise the Lua profile scripts assigning custom properties to `result` created in node_function and way_function. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk