# untested, ~psuedo code rows = arcpy.SearchCursor(indexGridLayer, "{0} = '{1}'".format(arcpy.addFieldDelimeters(indexGridLayer,"PageName"), currentPageName) for row in rows: if row.getValue("LabelPoints") == "yes": pointsLayer.showLabels = True polygonsLayer.showLabels = False else: pointsLayer.showLabels = False polygonsLayer.showLabels = True
You could add attributes to the index features and use that to drive which layer to label. I.e. add a yes/no "LabelPoints" field and then add something like the following:# untested, ~psuedo code rows = arcpy.SearchCursor(indexGridLayer, "{0} = '{1}'".format(arcpy.addFieldDelimeters(indexGridLayer,"PageName"), currentPageName) for row in rows: if row.getValue("LabelPoints") == "yes": pointsLayer.showLabels = True polygonsLayer.showLabels = False else: pointsLayer.showLabels = False polygonsLayer.showLabels = True
This does add a little maintenance to the process, as you need to review that the attribute is correct periodically, but if things don't change much, that's probably not a big deal. With that added maintenance, I'm not sure if this is the best solution but it is a solution.
Hello, msayler, I really thank you for your answer!
I know almost nothing about coding, so I apologize if the following questions seem too dumb:
- Does this code you provided allow some point and some polygon features to be labelled at the same time (at the same page)? I need both features to be labelled, the preference being for point features over polygon features when features that have the same attributes (one being point and the other being polygon) occur within the data frame.
- Where in ArcMap should I insert the code, so it executes every time I change data-driven pages?
Congratulations! Whole new world now, isn't it? 😮