turf: Getting error while finding difference between a multipolygon and a polygon
I am getting following error while finding the difference betweeen a polygon and a multipolygon.
/Users/AmishaSingla/Documents/osm-adiff-compare/node_modules/@mapbox/osm-compare/node_modules/@turf/difference/node_modules/jsts/dist/jsts.min.js:14
ln.checkValid(this.edgeList.getEdges()),this.graph.addEdges(this.edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Sn(this.geomFact);n.add(this.graph),this.resultPolyList=n.getPolygons();var i=new wn(this,this.geomFact,this.ptLocator);this.resultLineList=i.build(t);var r=new Ln(this,this.geomFact,this.ptLocator);this.resultPointList=r.build(t),this.resultGeom=this.computeGeometry(this.resultPointList,this.resultLineList,this.resultPolyList,t)},labelIncompleteNode:function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.arg[e].getGeometry());t.getLabel().setLocation(e,n)},copyPoints:function(t){for(var e=this.arg[t].getNodeIterator();e.hasNext();){var n=e.next(),i=this.graph.addNode(n.getCoordinate());i.setLabel(t,n.getLabel().getLocation(t))}},findResultAreaEd
The polygon and multipolygon are following:
- http://bl.ocks.org/d/44385641e432c52cdfd548218454fd42
- http://bl.ocks.org/d/28768027d930ce93f0798fa6f6463fad
Source Code: https://jsfiddle.net/tboq1cv5/
Not sure if the input to difference method is right or not.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Fix jsts empty (Multi)Polygon error - Major refactoring to `index.js` & `test.js` - Update JSDocs & Typescript definition to support MultiPolygon https://github.com/Turfjs/turf/issues/721 — committed to Turfjs/turf by DenisCarriere 7 years ago
- Fix jsts empty (Multi)Polygon error @turf/difference (#725) * Update fixtures from https://github.com/Turfjs/turf/pull/644 * Fix jsts empty (Multi)Polygon error - Major refactoring to `index.js` ... — committed to Turfjs/turf by DenisCarriere 7 years ago
Awesome, this works 💯 . Thanks @DenisCarriere 😃
Wohooo 🎉 On it.