1

I'm trying to merge the polygons (administrative boundaries) in a dataset untill they reach a minimum value. Lets say that the polygon dataset consists of the number of people per polygon and I need each polygon to contain at least 100 people. In that case I want the polygons with a value less than 100 to merge with an adjecent polygon, preferably in this order:

  1. merge polygon with one adjecent polygon that contains less than 100 people
  2. if adjecent polygons of less than 100 people are not available, merge with a polygon that contains 100 or more people.
  3. if after the merge the minimum number is not reached yet, repeat the process untill no more adjecent polygons are available.
  4. The end result should be a polygon dataset in which as many polygons as possible have at least 100 people per polygon.

I hope this discription is clear enough. Let me know if you need more info.

I'm using ArcMap 10.2.1. I already tried the dissolve tool, but this doesn't have the option to dissolve based on a minimum value. I saw that during an edit session in ArcMap you can merge polygons manually, but I found no way to do this in a model or a python script. If necessary I'm open to use other tools such as QGIS or SpatiaLite.

0

1 Answer 1

0

The process you need to design will have to be developed in several stages. I would start the process by first selecting all polygons less than 100 population and using Spatial Join with the One to Many option for that selection set against itself. This will create the set of adjacent features with insufficient population touching other similar polygons.

You could now run a cursor to load a dictionary with population/TargetID tuple keys containing a list beginning with the the population/JoinID that matched the TargetID followed by the sorted set of other population/JoinID values.

Now you can process the sorted dictionary keys to start with the smallest population/TargetID. Go through the associated list of polulation/JoinID keys to accumulate a population variable until you reach a number of 100+. You could write the TargetID back to the original polygon features as a Dissolve field.

Keeping track of everything efficiently so that polygons are not reused would take some experimentation to figure out and I am not sure of the optimal processing order, since it would take too long to evaluate all of the potential ways to combine the polygons. Probably you should keep a list of used IDs and a list for each targetID to make sure you reached the minimum goal. If a certain feature did not reach its goal you would not assign that ID to the original polygons or to the list to allow another touching polygon to see if it could reach the goal.

Then process a Dissolve on the set of features with a targetID assigned. Delete that set and replace them with the Dissolved features that summarized the total population. You should probably also experiment with using the Python geometry operations such as the polygon.union() method to replace the use of the Dissolve tool.

Then repeat the process, but this time Spatial Join the entire set of polygons with the entire set of polygons. You would only create dictionary keys if the initial polygon has a population less than 100, but the value list would include all touched polygons. Then repeat the accumulation, TargetID assignement process again.

I think this would reach the end result you want and be the fastest process, but this code would take a fair amount of experimentation to design and test.

Not the answer you're looking for? Browse other questions tagged or ask your own question.