Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

How to zoom to layer with page definition query set in arcpy?

$
0
0

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:

Full layer

After enabling the page definition query, right clicking on the layer and clicking Zoom to Layer yields this:

Using the UI to zoom to layer

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:

Arcpy method

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?


Viewing all articles
Browse latest Browse all 767

Trending Articles