Skip to content

Story: Add the EWKT decoding strategy and spatial reference support #32

Closed

Description

@Alexandre-T

Add the EWKT decoding strategy and spatial reference support

As a user of the spatial decoder,
I want to decode Extended Well-Known Text (EWKT) representations,
so that geometries containing PostGIS spatial reference information can be
converted into the corresponding spatial objects.

Context

PostGIS EWKT extends Well-Known Text with spatial reference information using
an SRID=<value>; prefix.

The decoder already provides WKT decoding and a lexer shared between WKT and
EWKT capable of recognizing SRID tokens. The EWKT strategy should reuse this
existing infrastructure rather than duplicate WKT parsing behavior.

An SRID is optional in EWKT. Spatial objects require an SRID and use 0 by
default. Consequently, an EWKT representation without an explicit SRID must
behave like the equivalent WKT representation and produce a spatial object
with SRID 0.

The SRID prefix belongs to the root EWKT geometry. Nested geometries do not
carry independent SRID prefixes.

Acceptance Criteria

  • An EWKT decoding strategy implementing DecoderStrategyInterface is
    available.
  • The EWKT strategy uses the lexer infrastructure shared with the WKT
    strategy.
  • An EWKT representation prefixed with SRID=<value>; is decoded into the
    corresponding SpatialInterface.
  • The SRID declared by the EWKT prefix is preserved in the resulting
    spatial object.
  • An EWKT representation without an SRID prefix is accepted.
  • When the SRID prefix is absent, the resulting spatial object uses SRID
    0, consistently with WKT decoding and the default behavior of
    spatial-types.
  • The SRID prefix is accepted only for the root geometry and is rejected
    when used on a nested geometry.
  • Existing WKT decoding behavior is reused where the EWKT syntax does not
    introduce EWKT-specific information.
  • Invalid SRID or EWKT syntax is reported through the decoder exception
    model.
  • Existing WKT decoding behavior remains unchanged.
  • Automated tests cover EWKT decoding with an explicit SRID, without an
    explicit SRID, and invalid SRID placement.

References

  • PostGIS ST_GeomFromEWKT documentation.
  • PostGIS liblwgeom EWKT lexer and parser.
  • OGC Simple Feature Access for the underlying WKT geometry syntax.
  • ISO/IEC 13249-3 for the underlying spatial geometry model and WKT semantics
    where applicable.

Activity

  1. added
    spatial:geometryRelated to geometry models or types
    spatial:wktRelated to Well-Known Text or Extended Well-Known Text
    standard:complianceImproves or restores standards compliance
    on Sep 30, 2026
  2. self-assigned this
    on Oct 2, 2026
  3. changed the title [-]Add the EWKT decoding strategy and spatial reference support[/-] [+]Story: Add the EWKT decoding strategy and spatial reference support[/+] 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:geometryRelated to geometry models or typesspatial:wktRelated to Well-Known Text or Extended Well-Known Textstandard:complianceImproves or restores standards compliance

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions