I'm using polygons to drive my Data Driven Pages in ArcMap Standard 10.2.

I have a point feature that shares a common attribute with the driver polygon, and using the Page Definition, I am showing that point as well (and the point is really the main focus of the map, but ideally we want to show it relative to the polygon extent).

However, the point is not centered in the polygon, and i have a max scale set via python, so, sometimes the point is not shown on the layout due to the shape of the polygon.

I'm wondering if there is a way to identify when that point will not be within the layout extent, so I can mark it to fix manually (or some other way). I guess the overall question is is it possible to determine whether a point feature is contained in the data driven layout extent?

I am exporting my Data Driven maps via python script, so i should have all python functionality when exporting.

closed as off-topic by PolyGeo Nov 26 '18 at 10:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.


This should be pretty doable using Extent objects.

If you are using python to run your Data Driven Pages, why don't you calculate the extent of the data frame every time you change pages.

Then, while that's going, calculate the geometry of your point layer. Use the contains method of the Extent object to determine whether the point is within the data frame extent. If not, change the scale of your dataframe to include the point.

I tested this with a simple DDP example using the following code:

for pageNum in range(1, mxd.dataDrivenPages.pageCount+1):
    mxd.dataDrivenPages.currentPageID = pageNum
    df_extent = mxd.dataDrivenPages.dataFrame.extent
    geometries = arcpy.CopyFeatures_management("DDP_Point",arcpy.Geometry())
    for row in arcpy.da.SearchCursor("DDP_Point",["SHAPE@",'ID']):
        if row[1] == str(pageNum):
            if not df_extent.contains(row[0]):
                print  row[1]

As you can see from the below example, point 4 is outside the extent of polygon 4. The above code returned 4 indicating that it worked. Note, point 3 is not in polygon 3 but still within the DDP extent of that polygon.

enter image description here

Alternatively, if you don't have that many polygons, you could calculate the scale of each map which would include the point and code that into a DDP_SCALE field in your polygon layer.

  • 1
    that's beautiful. was not aware of the extent object, thanks! – mike Mar 4 '15 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.