Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on difference - likely due to overlapping segments #142

Open
Tracked by #1
rowanwins opened this issue Oct 6, 2022 · 0 comments
Open
Tracked by #1

Error on difference - likely due to overlapping segments #142

rowanwins opened this issue Oct 6, 2022 · 0 comments

Comments

@rowanwins
Copy link
Contributor

Error thrown

Unable to complete output ring starting at [54.56795530519258, 24.44447467409078]. Last matching segment found ends at [54.57080496898934, 24.4416737163564].

Input features with overlapping segments

const fc = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              54.569778932416476,
              24.441366817541834
            ],
            [
              54.56977894449294,
              24.441074136738756
            ],
            [
              54.57000000000001,
              24.441190327160086
            ],
            [
              54.57084694057397,
              24.440745161222193
            ],
            [
              54.57084693745136,
              24.44028034081218
            ],
            [
              54.571147760242575,
              24.44043845608456
            ],
            [
              54.57114771720956,
              24.441853864959285
            ],
            [
              54.57080496898934,
              24.4416737163564
            ],
            [
              54.57080502276297,
              24.441026402022757
            ],
            [
              54.57074511559248,
              24.441057889217532
            ],
            [
              54.57074509421786,
              24.441642246152345
            ],
            [
              54.57000000000001,
              24.441250624330703
            ],
            [
              54.569778932416476,
              24.441366817541834
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              54.56658645236534,
              24.445194105819738
            ],
            [
              54.56658654953498,
              24.441605817571325
            ],
            [
              54.57000000000001,
              24.43981171174874
            ],
            [
              54.57341345046501,
              24.441605817571325
            ],
            [
              54.573413547634665,
              24.445194105819738
            ],
            [
              54.57000000000001,
              24.44698828825126
            ],
            [
              54.56658645236534,
              24.445194105819738
            ]
          ],
          [
            [
              54.56795530519258,
              24.44447467409078
            ],
            [
              54.57000000000001,
              24.4455493756693
            ],
            [
              54.57204469480743,
              24.44447467409078
            ],
            [
              54.57204465994316,
              24.442325298422087
            ],
            [
              54.57000000000001,
              24.441250624330703
            ],
            [
              54.56795534005685,
              24.442325298422087
            ],
            [
              54.56795530519258,
              24.44447467409078
            ]
          ]
        ]
      }
    }
  ]
}

const out = polygonClipping.difference(fc.features[0].geometry.coordinates, fc.features[1].geometry.coordinates)

Reported downstream use in TurfJS Turfjs/turf#2277

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant