I'm trying to merge 2 polygons (green) on Google maps (API v3 Javascript) with clipper.js.
before : http://jsfiddle.net/kevdiho/tc53Y/
My goal is to have only 1 polygon (red). The problem is that the final polygon is not exactly follow the path and sometime it's even worst.
after : http://jsfiddle.net/kevdiho/uF6ec/
to merge the 2 green polygons i used clipper.js and this function ClipperLib.ClipType.ctUnion
var clipType = ClipperLib.ClipType.ctUnion;
function mergePolygon()
{
for(j=0;j<array_polygon.length;j++){
array_polygon_clipper = createarray_clipper_polygon(array_polygon[j]);
subj_polygons.push(array_polygon_clipper);
}
cpr.AddPolygons(subj_polygons, ClipperLib.PolyType.ptSubject);
var succeeded = cpr.Execute(clipType, solution_polygons);
return solution_polygons;
}
How can i solve this problem? Clipper.js is a good answer or there are other libraries to work with googlemaps polygons?