Create label classes using Python, or is there a simpler way?

1531
5
01-17-2017 12:09 PM
EricHeinrichs
Occasional Contributor

I am working on a land ownership map for my rural municipality. I need to create a new label class for each section, since I need the key numbering for the labels to reset for each section. 

 

I have 324 sections for the municipality, and creating a new label class and key numbering group for each section would be an incredibly tedious and long manual task.

 

Is there any chance that I could create label classes and key numbering groups iteratively using a Python script? 

 

Or, is there a way to achieve this outcome in a simpler way?

Here's an example of what I am doing. I will convert the labels to annotations, and move the key numbering labels to the left side of the map to act as a legend to correspond to the numbers within the polygons that are too small to label. 

Reply
0 Kudos
5 Replies
WesMiller
Regular Contributor III

I usually number everything with the OID field then turn off all fields i don't need and add table to the map.

EricHeinrichs
Occasional Contributor

I don't think that would really work for us, since we still want to show ownership that fits within the parcel. Otherwise, our table would be too large (we have 3670 parcels). 

Reply
0 Kudos
WesMiller
Regular Contributor III

You could try a query based on parcel size. Find out the smallest parcels being labeled then create a table for those less than that size.

Reply
0 Kudos
TiffanySelvidge1
Occasional Contributor III

Is your platform SQL based? If so, then you should be able to easily do what you want in sql server. Stack Overflow has more than a few questions about iterative numbering. This link sequential - Sequentially number rows by keyed group in SQL? - Stack Overflow  has some good ideas. After numbering your records (based upon the groups), convert back to a shapefile. Your labeling can be based off one of the new fields. You could include some extra code if you only want to label polygons that are less than a certain size.

Reply
0 Kudos
EricHeinrichs
Occasional Contributor

I have thought about this, and it looks good, so I think I will try something along these lines.

I'll have to fudge it a bit, and just set a physical size limit to labelling, instead of relying on ArcMap to handle it for me. 

This sounds like the fastest and least stressful way to do this, especially when our parcel map changes with splits and subdivisions.

Thanks!

Reply
0 Kudos