Skip to content

Dimension handling with setPrecision / reducePrecision #1152

@mwtoews

Description

@mwtoews

I see a few inconsistencies with GEOSGeom_setPrecision. For example:

  1. $ ./bin/geosop -a "LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)" reducePrecision 1
    LINEARRING Z EMPTY
  2. $ ./bin/geosop -a "LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)" reducePrecisionKeepCollapsed 1
    LINESTRING (0 0, 0 0, 0 0)
  3. $ ./bin/geosop -a "LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)" reducePrecisionPointwise 1
    LINEARRING (0 0, 0 0, 0 0, 0 0, 0 0)

Here are my guesses for better answers:

  1. Should be LINEARRING EMPTY (without Z dimension)
  2. Should not be LINESTRING, but perhaps be LINEARRING (0 0, 0 0, 0 0)
  3. Probably fine?

More on case 1, GEOSGeom_setPrecision test<10> doesn't fail because ensure_geometry_equals ignores Z/M dims, thus LINEARRING Z EMPTY == LINEARRING EMPTY. There is a similar issue with GEOSGeom_transformXY test<10> where POINT Z EMPTY is returned and compared equal to POINT EMPTY. I'd like ensure_geometry_equals to check if (GEOSHasZ(g1) != GEOSHasZ(g2)) || (GEOSHasM(g1) != GEOSHasM(g2)).

The issue is probably related to GeometryTransformer / GeometryFactory::createLinearRing().

See also trac #1135

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions