openfreemap icon indicating copy to clipboard operation
openfreemap copied to clipboard

Wrong encoded ids for some features

Open zbycz opened this issue 1 year ago • 4 comments

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

  1. If I click on Prague while changed to OpenFreeMap layer – eg. here: osmapp.org#8.60/50.06/14.63
  2. I see in DevTools it has id 16018379311
  3. It is decoded as 1->way, thus way/1601837931, and osmapp brings us to this URL osmapp.org/way/1601837931
  4. 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.

(same issue in indoor= stack: https://github.com/indoorequal/indoorequal/issues/49)

https://github.com/zbycz/osmapp/issues/771

zbycz avatar Nov 19 '24 07:11 zbycz

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=false if 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?

hyperknot avatar Nov 19 '24 19:11 hyperknot

Thanks @hyperknot! I added the issue here https://github.com/onthegomap/planetiler/issues/1120 🤞

zbycz avatar Nov 29 '24 11:11 zbycz

Great and really detailed issue! I'd mention that you are planning to use it for osmapp.org, which is a very impressive project!

hyperknot avatar Nov 29 '24 13:11 hyperknot

@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?

tmorell avatar May 22 '25 02:05 tmorell

FYI - we are getting some resolution for 1/2/3 schema in planetiler-openmaptiles, which possibly means the same also in planetiler repo.

zbycz avatar Jun 16 '25 09:06 zbycz

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! 👍🥇❤️

zbycz avatar Jun 20 '25 11:06 zbycz