3

I have a set of maps I am creating with Data Driven Pages. Each map has a scale and rotation set by the feature class that is driving the map creation. I would like to create a polygon that is the extent of each page that is created - not the polygon from the DDP index feature class. Is this possible?

I am playing around with the Fishnet, as my page size is the same, but not sure I can put the rotation into that.

  • YEs Chris - that DD Element was part of the solution - but now how to generate a list of these that I can use to create Features of the extents? – BretW Jun 3 '15 at 18:27
  • 1
    Maybe you can find a way to use or learn from this add-in: arcgis.com/home/item.html?id=a9b032f739254ebeb6221c9294ebc886 – johns Jun 3 '15 at 19:48
  • Thanks johns - that does the trick - unfortunately it does not maintain the rotation, but that can be fixed easily. – BretW Jun 3 '15 at 21:06
  • Sorry, thought you were just looking for the coordinates or to label them. I missed/misunderstood the create an actual poly feature out of said extent part. You can put a rotation in a fishnet btw, but I wasn't sure how that would help with a constantly changing (including rotation) view extent. – Chris W Jun 4 '15 at 1:17
1

I did something similar once, created a polygon based on the data driven extent of each page, I then used that to do an intersect query and update data as it pertained to each page. Here's the code I used, maybe it can help you:

mxd = arcpy.mapping.MapDocument("CURRENT")
for i in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = i
    print "Current page: " + str(i)
    print "Getting reference extent..."
    coords = [mxd.dataDrivenPages.dataFrame.extent.lowerLeft, mxd.dataDrivenPages.dataFrame.extent.lowerRight,
              mxd.dataDrivenPages.dataFrame.extent.upperRight, mxd.dataDrivenPages.dataFrame.extent.upperLeft]
    polyArray = arcpy.Array([coord for coord in coords])
    myPoly = arcpy.Polygon(polyArray, mxd.dataDrivenPages.dataFrame.spatialReference)
    if arcpy.Exists("/path/to/extent.shp"):
        arcpy.Delete_management("/path/to/extent.shp")
    arcpy.CopyFeatures_management(myPoly, "/path/to/extent.shp")

Run from the ArcMap Python console, it grabs the corners of the data-frame, then uses those points as input to create a polygon that gets saved to a Shapefile. This script overwrites each successive page's Shapefile with the next page, so if you want a polygon for each page, you'll have to rename the output with each iteration of the loop (otherwise, you will end up with output only for the last page).

0

johns made a comment suggesting an ArcGIS add-in that mostly does what I want: Map Extent to Polygon by Jakub Sisak. It does not maintain the rotation, but I can work around that easily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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