openfreemap
openfreemap copied to clipboard
Wrong encoded ids for some features
Hi,
we have integrated OpenFreeMap in osmapp.org, but there is an issue with type encoded in the id field in the MVT tiles. The last number in the id should encode 0=node, 1=way and 4=relation.
Example
- If I click on Prague while changed to OpenFreeMap layer – eg. here: osmapp.org#8.60/50.06/14.63
- I see in DevTools it has id
16018379311 - It is decoded as 1->way, thus
way/1601837931, and osmapp brings us to this URL osmapp.org/way/1601837931 - same issue is with almost all active POIs on the map.
Expected result:
In reality it is a node, so it should end with 0. If we use the default layer Basic from Maptiler, it works correctly.
.
Relevant issues / related code:
Maptiler also had a long time issues with wrong encoding IDs, I believe they were using openmaptiles internally, but later switched to thier own impl (planetiler?) and that needed fixes to the id encoding too.
- example in openmaptiles sql (may be wrong)
- encoder/decoder in typescript in osmapp
- original (fixed) issue in imposm
- openmaptiles issue – Maptiler managed to fix it in their prod server, but probably not in openmaptiles code.
- possibly relevant planetiler issue with links to PRs
(same issue in indoor= stack: https://github.com/indoorequal/indoorequal/issues/49)
https://github.com/zbycz/osmapp/issues/771
Luckily it's a single change, OFM uses planetiler and planetiler uses this system
Yep that's the new behavior as of #826 - the vector tile feature IDs are
osm ID * 10 + {1 for OSM nodes, 2 for OSM ways, 3 for OSM relations, 0 for any other source}so you can tell whether the feature came from a node, way or relation. You can set--feature-source-id-multiplier=falseif you want to disable the behavior and just set vector tile feature IDs to the original ID of the osm element.
https://github.com/onthegomap/planetiler/issues/1042#issuecomment-2381317501
Can you open an issue in planetiler to change the system to from 123 to 124?
Thanks @hyperknot! I added the issue here https://github.com/onthegomap/planetiler/issues/1120 🤞
Great and really detailed issue! I'd mention that you are planning to use it for osmapp.org, which is a very impressive project!
@zbycz Changing the encoding schema from 1/2/3 to 0/1/4 will break existing applications that rely on the current schema. Would there be a notification when this change happens? Is there an OpenFreeMap newsletter or similar updates?
FYI - we are getting some resolution for 1/2/3 schema in planetiler-openmaptiles, which possibly means the same also in planetiler repo.
So, i decided to let go my "standardization effort" to use the 0/1/4 schema everywhere, and just adapt the code for OpenFreeMap/planetiler anomaly. :-)
https://github.com/zbycz/osmapp/pull/1111
So finally, the OpenFreeMap is clickable on OsmAPP.org – enjoy! And thanks for your wonderful project! 👍🥇❤️