I have a polygon feature class Base_FC, where each poly has a unique alphanumeric ID. My second polygon feature class Type_FC has the details for the various polygons which would fall inside Base_FC when intersected. These polys have unique alphanumeric IDs as well.

For display purposes, I would like to assign each Type_FC poly that falls within a Base_FC poly a number, along with its neighbouring polys. For example:

  • Base_FC polygon B1 contains three Type_FC polys T5, T8 and T11.
  • Base_FC polygon B2 contains four Type_FC polys T20, T21, T25 and T30.

The numbers should ideally be assigned spatially from left to right, so if B1 has the polys going from left to right as T8, T5 and T11, they would be labelled 1, 2 and 3 respectively. I realise that there are a number of ways to do this - the method I was thinking of was to create a model which iterates through each Base_FC feature, selects by location all the Type_FC features it contains, then use the Python field calculator to number them - but I'd like to know of other methods, or if there is a tool out there which can do this.

I'm also not sure how to handle the issue of numbering them so that visually it looks good. Maybe using the coordinates of the centroids to ensure numbering goes from left to right?

  • One quick question. What do you mean by polygons on left or right? You meant centroid is to the left or right?
    – Naresh
    Jun 15, 2012 at 8:59
  • Sorry if I'm not making much sense. To clarify: if you are looking at the map, you can see the three polygons which I would like to be numbered from west to east, so the polygon on the western side would be 1, the next one 2, and the one on the eastern side 3. That's why I was thinking of assigning centroids, so I can determine from the coordinates the "order" of the polygons from west to east, then north to south, and label accordingly. Jun 15, 2012 at 9:04

2 Answers 2


Had a quick think about your idea, this is is how I would approach it in modelbuilder:

  • Add an X field to your Type_FC
  • Populate X field with the centroid's X coordinate.
  • Use spatial join tool to pass the ID of the Base_FC polygons to your Type_FC polygons
  • Have an iterator cycle through the Base_FC ID's in your Type_FC polygons
  • For each ID create a new FeatureLayer setting the where clause to ID
  • Sort resulting featurelayer based upon X field
  • Get a count on the number of rows, lets call this "i"
  • Run a calculate to add numbers 1 to "i"
  • That sounds good, it would be better to use the ID as you have said instead of selecting purely on location as I know that normally can include polys I don't want. What about where the polygons are underneath each other, e.g. the first 3 Type_FC polys are adjacent, so they are labelled east to west 1, 2 and 3. A fourth Type_FC poly is situated below poly 1, so should be labelled 4, but its X-coord will be the same as poly 1. I think first sorting by the X-coord then the Y-coord will give the correct order for numbering. Jun 18, 2012 at 5:51
  • I tried your method (slightly modified with another spatial join) and realised that sorting on the x-coord does not help. Adding the y-coord to the sort does not help either. It certainly does not pick the correct start point i.e. the poly in the upper left hand 'corner'. It instead picks a poly further south (the x-coord is not even the 'smallest'), then jumps to one above it, then jumps further down towards the west. Jun 19, 2012 at 14:00

I determined what I actually wanted to do based on the comments on the question I asked here. However I realised it was not critical that I assign the display numbers in a particular way, as long as they were unique to the Type_FC polygons within each Base_FC polygon. My final solution was simply to use a Feature Selection Iterator (which was brought to my attention here), group by the unique alphanumeric ID, and calculate the display number using this solution from the Knowledge Base.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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