javascript - Merging intersecting polygons to single polygon - Stack Overflow

Question : I want to remove overlaps from existing polygons with javascript.I guess merging overlapping

Question :

I want to remove overlaps from existing polygons with javascript.

I guess merging overlapping polygons to single polygon is the easiest way to do this but i don't know how to do this.

Question :

I want to remove overlaps from existing polygons with javascript.

I guess merging overlapping polygons to single polygon is the easiest way to do this but i don't know how to do this.

Share Improve this question edited Apr 13, 2020 at 12:33 Utku asked Nov 3, 2015 at 15:21 UtkuUtku 3004 silver badges19 bronze badges 1
  • Just wondering if there is some simpler workaround. Is the main aim trying to get the polygons together as one, or is that a workaround for something else you are trying to achieve, if so, whats that ? – Ian Commented Nov 4, 2015 at 8:22
Add a ment  | 

2 Answers 2

Reset to default 3

You need to implement Vatti's algorithm or use some polygon library which realizes it (or other reliable algo).

Clipper library uses this algorithm, but seems it has not JavaScript binding yet.

Javascript port exists for GPC (sometimes less robust)

Since @MBo's answer is out of date, here is a new answer. The math has already been written down in JavaScript:

  • polygon-clipping
  • martinez-polygon-clipping

polygonClipping.union(triangle, hexagon, house, diamond) (from the first package) returns the polygons like in your question.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745554972a4632765.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信