Layer Page Definition in ArcPy

06-06-2017 04:04 PM
Status: Under Consideration
Labels (1)
Occasional Contributor

Currently there is a gap between what you can do in ArcMap and what you can do with the arcpy mapping module. In particular I would like to see the Layer Class properties to be expanded. Specifically the data driven page properties within a layers definition query. I was thinking along the lines of something like the LabelClass but for definition queries instead.

Layer—Help | ArcGIS Desktop 

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
    if lyr.supports("LAYER_DEFINITION"):
        if lyr.layerdefinition is True:
            print "Layer name: " +
            print "    Layer Definition:            " + lyr.layerdefinition.expression
            print "    Page Definition Enabled:     " + lyr.layerdefinition.pagedefinition
            print "    Page Definition Expression:  " + lyr.layerdefinition.pagedefinitionexpression
del mxd‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I have just dealt with a data-model change that saw a bunch of fields get consolidated better through out our business and now I am faced with the prospect of changing 100+ mxd's to a new data structure with most having data driven pages driven from one of the fields that was changed. No Drama just script the update however the page definition is the one attribute I am now unable to update and have to now go through manually and correct these.


MPCGroup_Admin‌ Can you please refine the idea's title to reflect something about exposing page definition through arcpy.mapping?  This should help others discover the idea through a search.  Currently, enhancement to arcpy.mapping is too general to be useful.  I think that updating the title will help in discoverability and ultimately up votes.

Thank you!


As we've moved on to Python 3 and ArcGIS Pro mostly, could we update this idea (or be allowed to make a new one)? I would very much like to see options to modify modify Map Series Page Filter (Page Query) with arcpy.

Status changed to: Under Consideration

Thanks for adding this idea.  We we consider it this for near term development.

Jeff - and Layout teams.