Add OSM elevation to point POIs#619
Conversation
Natural peak features are usually OSM point features, but the POI layer only copied the OSM ele tag while building the named-polygon point-on-surface output. That meant point peaks were emitted without the elevation attribute even when the source feature had ele set. Move the elevation assignment into the common POI attribute chain so all OSM POIs can carry ele through to the output feature. This preserves the existing named-polygon behavior and lets Planetiler omit the attribute naturally when ele is absent. Add a regression test covering natural=peak with ele to make sure peak POIs expose elevation. Verification: ran PoisTest, full mvn package, spotless:check, git diff --check, and before/after Saarland PMTiles scans. The Saarland z15 scan changed from 0/489 peak features with elevation before the fix to 425/489 after the fix; the remaining peaks lack OSM ele in the source. AI assistance: this change was prepared with help from OpenAI Codex.
|
Thanks, this is a good candidate for inclusion: https://tilezen.readthedocs.io/en/latest/layers/#points-of-interest I do think it makes more sense for the |
|
Numeric makes sense to me. It is semantically the better type, and the OSM wiki defines One caveat: I did a quick check: OSM-wide, Taginfo shows
Given the OSM semantics and that Tilezen documents this as an elevation value, I’m happy to update the PR to parse |
|
I think |
OSM ele represents elevation in metres, so expose POI elevation as a numeric tile value instead of passing through raw tag text. This applies both to polygon-derived POIs that already carried elevation and to point POIs added by the previous change. Add a conservative parser that accepts clean signed decimal values, including an optional trailing m suffix with or without whitespace, and emits rounded integer metres. Omit elevation when ele contains other units or free text. Update POI tests to assert integer elevation for peak and named polygon output and cover decimal, metre-suffixed, and invalid values. AI assistance: This change was prepared with help from OpenAI Codex.
|
|
Thanks, that makes sense. I added the numeric conversion as an additional commit on the PR, consolidating elevation on a numeric integer value. A float would also have been reasonable because OSM ele can contain decimal metre values. I went with integer metres because the OSM wiki describes ele as elevation in metres, and integer metre values are simpler to consume for most map/style use cases. Decimal metre values are rounded to the nearest integer. The parser now accepts plain numeric OSM ele values and metre-suffixed values with or without whitespace, for example 569, 569.5, 569 m, and 569m. Non-metre/free-text values are omitted. I did a test extract and everything looks as expected |



Overview
I recently switched my personal project, https://wogibt.es/, from OpenMapTiles to Protomaps. Most attributes had a clear equivalent, but mountain peak elevation was missing: OSM
elevalues were not being exposed as theelevationattribute on Protomaps POIs.
I do not think this is intended behavior, since
natural=peakfeatures commonly rely onelefor displaying summit elevation.Example node: https://www.openstreetmap.org/node/1308250615/history/2
Before:
After:
Technical details
natural=peakfeatures are usually OSM point features. The POI layer already copied the OSMeletag toelevation, but only in the named-polygonpointOnSurfacepath. Point POIs therefore lost the attribute even when the sourcefeature had
ele.This change moves the
elevationassignment into the common POI attribute chain, so OSM POIs can carryelethrough to the output feature. Existing named-polygon behavior is preserved, and Planetiler still omits the attribute wheneleis absent.A regression test was added for
natural=peakwithele.Verification
Ran:
PoisTestmvn packagespotless:checkgit diff --checkFor the Saarland z15 scan:
elevationelevationThe remaining 64 peak features do not have OSM
elein the source data.AI assistance
This change was prepared with help from OpenAI Codex 5.5 xhigh.