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

Union of a polygon and its simplified version fails #1209

Closed
gdrouet opened this issue Dec 29, 2017 · 3 comments
Closed

Union of a polygon and its simplified version fails #1209

gdrouet opened this issue Dec 29, 2017 · 3 comments

Comments

@gdrouet
Copy link

gdrouet commented Dec 29, 2017

I have a set of polygons that I simplify.
Then I compute the union of this simplification with its original version.
I have some case when the following error occurs:

{ Error
    at TopologyException.RuntimeException [as constructor] (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:24925:19)
    at new TopologyException (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:30875:25)
    at DirectedEdgeStar.propagateSideLabels (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:35610:43)
    at DirectedEdgeStar.computeLabelling (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:35711:8)
    at DirectedEdgeStar.computeLabelling (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:35977:47)
    at OverlayOp.computeLabelling (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:40900:23)
    at OverlayOp.computeOverlay (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:40838:10)
    at OverlayOp.getResultGeometry (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:40812:10)
    at Function.OverlayOp.overlayOp (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:40935:20)
    at SnapIfNeededOverlayOp.getResultGeometry (C:\Users\gdrouet\Documents\nomotech\node_modules\@turf\turf\turf.js:39762:24)
  name: 'TopologyException',
  message: 'side location conflict',
  stack: 'Error\n    at TopologyException.RuntimeException [as constructor] (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:24925:19)\n    at new TopologyException (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:3
0875:25)\n    at DirectedEdgeStar.propagateSideLabels (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:35610:43)\n    at DirectedEdgeStar.computeLabelling (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:35711:8)\n
   at DirectedEdgeStar.computeLabelling (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:35977:47)\n    at OverlayOp.computeLabelling (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:40900:23)\n    at OverlayOp.comp
uteOverlay (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:40838:10)\n    at OverlayOp.getResultGeometry (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:40812:10)\n    at Function.OverlayOp.overlayOp (C:\\Users\\g
drouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:40935:20)\n    at SnapIfNeededOverlayOp.getResultGeometry (C:\\Users\\gdrouet\\Documents\\nomotech\\node_modules\\@turf\\turf\\turf.js:39762:24)',
  pt: Coordinate { x: -1.2767639133054933, y: 48.63582536868326, z: undefined } }

Ex 1:

Ex 2:

Ex 3:

Ex 4:

Ex 5:

You can see that simplified polygons are kinked, maybe this is linked.

@gdrouet
Copy link
Author

gdrouet commented Dec 29, 2017

I confirm that if I unkink the simplified polygons and then compute the union of all the resulting polygons with the original version, I obtain a valid workaround.

@rowanwins
Copy link
Member

Thanks for the detailed report @gdrouet , we aware that our union function doesn't handle self intersecting polygons very well, it currently relies on the jsts library, but we write close to replacing this dependency with something that does, so stay tuned!

@tmcw
Copy link
Collaborator

tmcw commented Jun 25, 2018

Closing; #88 is the tracking issue for JSTS.

@tmcw tmcw closed this as completed Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants