javascriptgeometrypolygonraphaelintersection

Merging intersecting polygons to single polygon


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.

I want to combine theese polygons This is the resault i want to achive


Solution

  • 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)