Skip to content

snapRoundingNoder on polygons result in MultiLineString #1133

Open

Description

@mortewle

When using the snapRoundingNoder on the attatched dataset with a precision scale of 10, I get a MultiLineString where the number of decimal places are all reduced to 1, but the number of coordinate pairs go from 2818 in the original polygon data to 5419 in the resulting MultiLineString. This makes the data larger in bytes and more complex to work with. Is this the expected behavior?

Also, why is the result a MultiLineString? I don't see an obvious way to convert this back to polygons as there is no info on what were polygon exteriors and what were holes/interiors.

snap_problem_area_1144.txt

Activity

  1. dr-jts commented on May 28, 2025

    @dr-jts
    Contributor

    Here's how to use the SnapRoundingNoder to produce a reduced-precision coverage. The input is

    • Input has 149 polygons with 2818 vertices. Many of the input polygons are very small and/or narrow.
    • Dissolve the input lines (result: 387 lines with 2316 vertices)
    • Use the SnapRoundingNoder with tolerance 1 (result: 1465 lines with 3376 vertices)
    • Polygonize the lines (result: 79 polygons with 1452 vertices)

    To map this back to the original polygons use point-in-polygon tests (which also finds holes/gaps).

    The result smallest polygon has area = 1. The input has 57 polygons of smaller area, which are probably all collapsed. Here's a closeup of an area where the snapped coverage contains fewer polygons, since a narrow polygon has collapsed:

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions