Repository navigation
Description
Decode EWKT dimensional representations
As a user of the spatial decoder,
I want EWKT dimensional representations to be decoded consistently,
so that equivalent PostGIS and standard dimensional syntaxes produce the
same spatial objects.
Context
PostGIS EWKT supports XY, XYZ, XYM, and XYZM geometries and accepts several
ways of expressing dimensional information.
The shared lexer can distinguish geometry types from Z, M, and ZM
dimensional markers, including markers directly appended to the geometry type.
The EWKT decoder should be permissive when multiple unambiguous
representations express the same dimensional semantics. The accepted syntax
does not need to be restricted to the canonical representation emitted by
PostGIS ST_AsEWKT().
Dimensional information must be resolved consistently and preserved in the
resulting SpatialInterface.
Acceptance Criteria
- The EWKT strategy decodes XY geometries.
- The EWKT strategy decodes XYZ geometries.
- The EWKT strategy decodes XYM geometries.
- The EWKT strategy decodes XYZM geometries.
- Explicit dimensional markers separated from the geometry type are
accepted, includingZ,M, andZM. - PostGIS compact dimensional forms with
Z,M, orZMappended to the
geometry type are accepted. - Dimensionality expressed implicitly by an EWKT representation is
correctly resolved when it is unambiguous with these rules : When no dimensional marker is present, EWKT dimensionality follows PostGIS semantics: two ordinates resolve to XY, three ordinates to XYZ, and four ordinates to XYZM. XYM is never inferred from an unmarked three-ordinate tuple and requires an explicit M marker - Equivalent compact, explicit, and implicit representations producex
spatial objects with the same geometry type, coordinates, dimensions,
and SRID. - Coordinate tuples are validated against the resolved dimensionality.
- Conflicting or ambiguous dimensional information is rejected through
the decoder exception model. - Dimensional decoding works both with an explicit EWKT SRID and with the
default SRID0when no SRID is provided. - Existing WKT decoding behavior remains unchanged.
- Automated tests cover the supported XY, XYZ, XYM, and XYZM
representations and invalid dimensional combinations.
References
- PostGIS
ST_GeomFromEWKTdocumentation. - PostGIS
liblwgeomEWKT lexer and parser. - OGC Simple Feature Access for standard WKT dimensional syntax.
- ISO/IEC 13249-3 for spatial dimensional semantics and WKT representations
where applicable.
Activity
Alexandre-T commentedon Sep 30, 2026
Point to validate before Ready
The acceptance criterion concerning dimensionality inferred implicitly from the
EWKT representation requires particular attention.
PostGIS EWKT may represent dimensionality through the number of ordinates
without an explicit
Z,M, orZMmarker. Before considering this StoryReady, each supported implicit representation should be verified to ensure
that its dimensionality can be determined unambiguously.
The decoder must not infer a dimensional model when the same coordinate tuple
could represent different semantics, particularly XYZ versus XYM.
Alexandre-T commentedon Oct 2, 2026
Decision (following PostGis decisions)
When no dimensional marker is present, EWKT dimensionality follows PostGIS semantics: two ordinates resolve to XY, three ordinates to XYZ, and four ordinates to XYZM. XYM is never inferred from an unmarked three-ordinate tuple and requires an explicit M marker.
A three-ordinate EWKT coordinate tuple without an explicit dimensional marker is XYZ. It MUST NOT be interpreted as XYM. XYM requires an explicit M dimensional marker.
AC updated
[-]Decode EWKT dimensional representations[/-][+]Story: Decode EWKT dimensional representations[/+]