[postgis-tickets] [PostGIS] #4973: ST_AsMVT returns broken tiles when column name and JSONB key are the same
PostGIS
trac at osgeo.org
Tue Aug 17 10:33:07 PDT 2021
#4973: ST_AsMVT returns broken tiles when column name and JSONB key are the same
----------------------------+---------------------------
Reporter: emreisikligil | Owner: pramsey
Type: defect | Status: new
Priority: critical | Milestone: PostGIS 3.1.4
Component: postgis | Version: 3.1.x
Resolution: | Keywords: ST_AsMVT
----------------------------+---------------------------
Comment (by Algunenano):
Looks like we aren't controlling that a key doesn't get added twice, which
can only happen when you use JSON / JSONB types.
The spec is clear in saying that this is forbidden:
{{{
Feature attributes are encoded as pairs of integers in the tag field of a
feature. The first integer in each pair represents the zero-based index of
the key in the keys set of the layer to which the feature belongs. The
second integer in each pair represents the zero-based index of the value
in the values set of the layer to which the feature belongs. Every key
index MUST be unique within that feature such that no other attribute pair
within that feature has the same key index. A feature MUST have an even
number of tag fields. A feature tag field MUST NOT contain a key index or
value index greater than or equal to the number of elements in the layer's
keys or values set, respectively.
}}}
I think that the simplest way to address this would be to keep only the
first key-value pair and ignore any extra appearances of that key in that
feature. If we went any other way we would need to remove the previously
added value (only if it's unique) and that would be a pain.
Note that this is likely to also happen if you have multiple JSONB columns
with the same key, so it's not an issue of just prefering columns of jsonb
values.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4973#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list