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

unable to complete output ring starting at #5

Open
MitchellMonaghan opened this issue Sep 5, 2023 · 1 comment
Open

unable to complete output ring starting at #5

MitchellMonaghan opened this issue Sep 5, 2023 · 1 comment

Comments

@MitchellMonaghan
Copy link

MitchellMonaghan commented Sep 5, 2023

Doing a intersect on these two shapes seems to produce the unable to complete output ring starting at error

{
        type: 'Feature',
        properties: {},
        geometry: {
          type: 'Polygon',
          coordinates: [
            [
              [
                -94.01653361819794,
                44.91274384567805
              ],
              [
                -94.01648672631458,
                44.91275462177405
              ],
              [
                -94.01653344003874,
                44.91275386419229
              ],
              [
                -94.01653361819794,
                44.91274384567805
              ]
            ]
          ]
        }
      }
      {
        type: 'Feature',
        properties: {},
        geometry: {
          type: 'Polygon',
          coordinates: [
            [
              [
                -94.01654779292787,
                44.91274058822198
              ],
              [
                -94.0164867263146,
                44.91275462177405
              ],
              [
                -94.01650378031933,
                44.91275434520002
              ],
              [
                -94.01654762526815,
                44.912753634142746
              ],
              [
                -94.01654779292787,
                44.91274058822198
              ]
            ]
          ]
        }
      }
@luizbarboza
Copy link
Owner

This issue can be resolved by setting the precision to something like 1e-12 before performing the operation.

For example:

polyclip.setPrecision(1e-12)

polyclip.intersection(poly1, poly2)

will give the following result:

[
  [ -94.01653361819794, 44.91274384567805 ],
  [ -94.01648672631458, 44.91275462177405 ],
  [ -94.01653344003874, 44.91275386419229 ],
  [ -94.01653361819794, 44.91274384567805 ]
]

map1
map2

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

2 participants