# Split polygon with holes to get several hole-less polygons

Unlike this thread I actually need to split the polygons into several hole-less polygons. I'm not sure on how to approach to this problem.

I have polygons with holes of many diferent shapes, like buildings, esplanades, rivers, etc. And I need to split them in a coherent way (if the polygon is a river it should be splitted perpendiculary to his axis) and with less splits as possible.

I need to do it programatically. I'm using ArcObjects 9.3, but if there is no other way I could try to use a specific algorithm to solve this problem.

• adding a picture would help! May 18, 2012 at 5:09

Are you always going to split using a straight line?

If so, you could try something like:

1. Find the center point of the hole.
2. Determine the orientation of the splitting line through that point (i.e. based on whatever rules you have for building, rivers, etc.) -- this might required other algorithms based on polygon type.
3. Split the polygon.
• There's no need to be straight lines, but it's an option. Anyway the tricky part is the second point, that's what I really need. For some type of polygons I can cut it by the smallest line intersecting the label point of the hole, but for other types the splitting lines can cross each other. I hope that there is an efficient algorithm(s) that could do the job. May 14, 2012 at 14:33
• Does it matter if splitting lines cross? Wouldn't you just do one split at a time? I think maybe you need to provide some examples to the original question to clarify. May 15, 2012 at 13:57

I didn't quite understand your requirement for splitting in a coherent way. However, if you're okay with severe fragmentation, you can just triangulate/tessellate your data.

"I have polygons with holes of many diferent shapes, like buildings, esplanades, rivers, etc. And I need to split them in a coherent way (if the polygon is a river it should be splitted perpendiculary to his axis) and with less splits as possible."

You don't give anywhere near enough information as to your requirements for all cases; The desired result is non-obvious. I suggest making a question for each category of thing you'd like to do. Include a picture in each case.

For simple rivers that don't begin or end in the frame, at least, here is an algorithm for finding the center-line... is that what you're asking for?

• Draw end lines where you'd like to slice the river
• Where those ends intersect the river polygons, identify intersecting vertices.
• Split the river by end lines
• Eliminate topological holes in the river polygon
• Convert river polygon to polylines
• Split lines by intersecting vertices
• Select lines which touch each pair of intersecting vertices (your riverbanks)
• Depending on what you're able to do in your environment, either:
• Create thiessen polygons from those lines

or

• Mark each line with a different attribute (bankid=1,2)
• Feature vertices to point (all)
• Create thiessen polygons from points
• Dissolve thiessen polygons by attribute
• Split by end lines