I have data driven pages enabled on a mxd, with a page definition query set on one of the layers to only show features that match the current index feature. This layer looks like this:
After enabling the page definition query, right clicking on the layer and clicking Zoom to Layer
yields this:
I would like to perform this function in arcpy. Setting the data frame’s extent to the extent of the layer using the getExtent()
method zooms to the extent of the entire layer:
This method does not honour the extent of the page definition query. I cannot use the zoomToSelectedFeatures()
method of the data frame because nothing is actually selected; similarly I cannot use the layer’s getSelectedExtent()
method. The only workaround I see is updating a normal definition query on the layer from arcpy and then getting the extent.
My question is, is there a way to use the UI’s Zoom to Layer
method from arcpy?