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.
Is there a way to use the UI's
Zoom to Layer method from ArcPy?