Skip to content

Story: Decode EWKT dimensional representations #33

Closed

Description

@Alexandre-T

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, including Z, M, and ZM.
  • PostGIS compact dimensional forms with Z, M, or ZM appended 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 SRID 0 when 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_GeomFromEWKT documentation.
  • PostGIS liblwgeom EWKT 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

  1. Alexandre-T commented on Sep 30, 2026

    @Alexandre-T
    ContributorAuthor

    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, or ZM marker. Before considering this Story
    Ready, 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.

  2. Alexandre-T commented on Oct 2, 2026

    @Alexandre-T
    ContributorAuthor

    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

  3. self-assigned this
    on Oct 2, 2026
  4. changed the title [-]Decode EWKT dimensional representations[/-] [+]Story: Decode EWKT dimensional representations[/+] on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

spatial:dimensionRelated to XY, XYZ, XYM or XYZM dimensions

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions