Select to view content in your preferred language

How to merge polygons in groups of (n)?

874
1
08-07-2023 01:57 PM
AJThompson_RSandH
New Contributor

Hello everyone, and thank you in advanced. I am trying to merge a layer containing an irregular grid of small polygons into slightly larger polygons. Ideally in groups of 20, but plus/minus 4 is acceptable. Below is an example where I merged the polygons by hand, but for a much larger area this could take many hours. Is there a way to automate this, or at least parts of it? There is no attribute consistency, so I believe it has to be a spatial process. 

 

Starting Layer:

SmallGrid.PNG

After Hand Merging:

LargeGrid.PNG

0 Kudos
1 Reply
SamSzotkowski
Regular Contributor

If you have a Spatial Statistics license, you could try out the Build Balanced Zones or Spatially Constrained Multivariate Clustering tools.

If not, perhaps you could use the Polygon Neighbors tool to figure out which polygons are adjacent to any given one, then treat this like a graph and write an algorithm to split it up into trees that represent clusters of between n-4 to n+4 polygons.  This may not be the best approach though, you'd have to be quite careful not to leave any "islands" of uneaten polygons, and you could end up with oddly shaped clusters.

Maybe to guarantee you use every polygon, you could imagine sliding a rectangle in a snakelike pattern over your polygons' envelope and keeping track of all the polygons it touches until you hit the cutoff you want.  This could actually be quite a fast algorithm if you pre-compute the envelope coordinates of all your input polygons.

0 Kudos