I have several polygons that I'd like not to overlap on the map at the points that they merge at. If I have separate latitude/longitude coordinate sets for all the polygons, how can I accomplish this? In the image below, I want the two circles filled in but not overlapping.
Solved! Go to Solution.
Can you try this:
make sure spatialReference is set for each polygon json, for example:.
var polygon = { type: "polygon", rings: paths, "spatialReference": {"wkid": 4326} };
And then make sure array's type is polygon:
polygons.push(new Polygon(polygon));
If the above doesn't work, can you please share more pieces of codes with a screen shot of the error from your browser's console?
Do you want an union?
I'm trying to use geometryEngine.union() with no success. I have several polygons defined like this where paths is an array of lat/long coordinates:
var polygon = { type: "polygon", rings: paths };
I then push each polygon into an array like this:
polygons.push(polygon);
At that point I use
var joinedPolygons = geometryEngine.union(polygons);
The API then throws an error that 'd is undefined'. What am I doing wrong?
Can you try this:
make sure spatialReference is set for each polygon json, for example:.
var polygon = { type: "polygon", rings: paths, "spatialReference": {"wkid": 4326} };
And then make sure array's type is polygon:
polygons.push(new Polygon(polygon));
If the above doesn't work, can you please share more pieces of codes with a screen shot of the error from your browser's console?
Thanks, geometryEngine.union() works with your advice. The explicit cast to a Polygon before pushing it into my array is what was missing in my code.