Skip to content

Story: Report collections of empty members as empty #65

Closed

Description

@Alexandre-T

Report collections of empty members as empty

As a consumer of spatial collections,
I want a collection containing only EMPTY members to report itself as EMPTY,
so that isEmpty() describes the represented geometry independently of stored member count.

Context

This Story addresses finding R4 in
Story #26.
Current collection implementations use stored-member count for emptiness.
A MultiPoint containing one EMPTY Point therefore reports isEmpty() === false.

On 2026-10-30, Alexandre confirmed that a collection composed only of EMPTY
members remains EMPTY. Members must still be preserved, including their order
and cardinality. A collection with a non-EMPTY member is not EMPTY.

The correction concerns MultiPoint, MultiLineString, MultiPolygon and
GeometryCollection, including nested GeometryCollections, wherever those types
are supported. It does not define new EMPTY rules for invalid polygon
boundaries, point sequences, CompoundCurve or other non-collection structures.
Member emptiness uses the applicable member's existing contract.

Acceptance Criteria

  • A collection with zero members reports isEmpty() === true.
  • A collection containing one or several members that all report EMPTY returns isEmpty() === true.
  • A collection containing at least one non-EMPTY member returns isEmpty() === false, regardless of EMPTY members or their positions.
  • Nested GeometryCollections containing only EMPTY descendants report EMPTY; a non-EMPTY descendant makes each containing GeometryCollection non-EMPTY.
  • Calling isEmpty() preserves every stored member, its identity, order and collection cardinality.
  • A mutable collection reflects changes between EMPTY and non-EMPTY caused by adding, removing or replacing members.
  • A collection holding mutable members reflects subsequent changes to a member's EMPTY state, including through nested collections and shared members, without requiring reinsertion.
  • Immutable replacement operations report the appropriate EMPTY state for the replacement while preserving the original collection and its members.
  • The behavior is consistent for all supported collection types, coordinate layouts, Geometry/Geography families and mutable/immutable variants.
  • EMPTY classification does not reject or remove members whose family, dimension, reference or geometric validity remains a consumer validation concern.

Constraints

Definition of Done

The project's common Definition of Done applies.

  • composer test-local passes.
  • composer quality passes.
  • Regression tests demonstrate the original all-EMPTY failure and cover zero, all-EMPTY and mixed members, nested collections, shared mutable members and immutable replacement preservation.
  • Explicit tests cover XY, XYZ, XYM and XYZM and both families for the supported collection variants.
  • Existing EMPTY-member tests are updated only where their isEmpty() expectations contradict the approved correction; member-preservation assertions remain intact.
  • docs/instantiable-spatial-types.md and other affected public documentation distinguish geometric emptiness from cardinality and disclose the changed result.
  • The Story Story: Review normative conformance for spatial-types 1.0.0 #26 conformance matrix links this correction and its automated evidence to R4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact:apiAffects the public APIimpact:breakingIntroduces a backward-incompatible changespatial:geometryRelated to geometry models or typesstandard:complianceImproves or restores standards compliance

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions