2

I have a polygon layer of watersheds (N = 1950) for South Africa. Within each watershed is a value (number of people; POPULATION field). I need to find a way to automatically group contiguous watersheds so that when the summed values of a group of watersheds falls between 50 and 100, those watersheds are assigned a unique ID in a new attribute field called GROUP.

The code that I'm looking for would need to run through the entire polygon layer, essentially assigning ID's (i.e., groups) to each watershed in the layer. I'd imagine that in a polygon layer of 1950 watersheds, there would be ~300 unique groups.

Exactly the same question has been posted previously (Clustering polygons by sum of values) but unfortunately they never posted their code.

2
  • You might want to take a look at this question. What you're trying to do is called Zone Design. The issue is the problem has an arbitrary number of solutions without more constraints. Depending on the order in which you sort/examine the watersheds and where you start, you can arrive at completely different groups and still meet the population requirements (as whuber's comments in the question you link to point out).
    – Chris W
    Commented Feb 5, 2015 at 0:16
  • Thank you very much for this information. The application provided by the University of Southampton appears to be exactly what I need.
    – Ross
    Commented Feb 6, 2015 at 5:43

0

Browse other questions tagged or ask your own question.