Layer Page Definition in ArcPy

1232
4
06-06-2017 04:04 PM
Status: In Product Plan
Labels (1)
MPC_KineticGIS_Department
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: " + lyr.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.

4 Comments
KoryKramer

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!

GISTeam4

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.

JeffBarrette
Status changed to: Under Consideration

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

Jeff - arcpy.mp and Layout teams.

JeffBarrette
Status changed to: In Product Plan

This will be made available in Pro 3.3.  The following members were added to the API:

Layer.pageQuery - r/o

Layer.setPageQuery({field_name}, {match})

 

Jeff - arcpy.mp and Layout SDK teams