How to explode multipart polygon but retain donut shapes

538
2
Jump to solution
08-13-2018 07:29 PM
PaulHaakma
Regular Contributor

Using the ArcGIS JavaScript 3.2x API, what would be the most efficient way to explode/break apart a multi-part polygon, yet retain those shapes that have holes in them as a single polygon?

Obviously we could extract all the rings into individual polygons, but then the 'holes' become polygons, and the original 'donut' looses it's hole. 

We could step through every ring, check it's direction and test whether it's inside/outside of every other ring, but that seems over the top.

Any suggestions on the most efficient way to do it?

cheers

-Paul

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Paul,

We could step through every ring, check it's direction and test whether it's inside/outside of every other ring, but that seems over the top.

There is no other way that I am aware of. Explode is something that is a Desktop operation that ArcObjects can handle easily but the JS API will be pretty slow at an operation like this.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Paul,

We could step through every ring, check it's direction and test whether it's inside/outside of every other ring, but that seems over the top.

There is no other way that I am aware of. Explode is something that is a Desktop operation that ArcObjects can handle easily but the JS API will be pretty slow at an operation like this.

0 Kudos
PaulHaakma
Regular Contributor

Thanks Robert.

It seems like a classic example of where there should be built-in methods. Maybe something for the future of the 4.x API!

cheers,

-Paul

0 Kudos