-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Some tile generators output MVT formatted tiles with degenerate polygons. This is technically legal according to the MVT spec:
A linear ring SHOULD NOT have an area calculated by the surveyor's formula equal to zero, as this would signify a ring with anomalous geometric points.
Maplibre JS and C++ implementations deal fine with such a degenerate polygon with only an exterior ring. It simply doesn't show up in the rendered output. Mapbox' vt2geojson tool outputs the degenerate polygon without any modification.
I didn't test more complicated polygons.
The Java MVT to MLT converter currently fails on such tiles, because the java-vector-tile library outputs such objects as empty GeometryCollections instead of retaining the coordinates without sanity checking.
Generally speaking, it seems undesirable to include this in any tile (MVT or MLT) because it probably won't be rendered. This is also how I understand the intent of the MVT spec: don't include it, but if it happens it will not break things.
I didn't spot a strict definition on this topic in the MLT spec. It seems sensible to me to adopt a similar stance ("SHOULD NOT include zero area linear rings") or a stricter one ("MUST NOT"), but I don't have a real opinion on this on spec level.
On the practical side, I propose for MLT encoders to drop invalid geometries and optionally issue a warning about this.
- making it an (unignorable) error forces users to fix this in their existing tile pipeline, which will slow down adoption
- dropping geometries silently is harder to debug. Making the user aware of the issue allows them to make a choice.
- optional to allow the encoder to set a sensible default (if this happens a lot,
--show-warningsmight make more sense than--hide-warnings).