Is there a way to count the number of data driven pages a polygon is on in an ArcGIS mapbook? I need to identify parcels that expand across multiple sections (which is my index for creating data driven pages), and I do not have any keys that would allow me to tie parcels to sections

I was able to write something up, the issue is I keep getting runtime errors because I'm looping a 50,000 item list through a 5,000 item list. Any algorithm suggestions?

def get_extent(section_class, parcel_class, sc_fields, pc_fields):
    sc_cursor = arcpy.da.SearchCursor(section_class, sc_fields)
    pc_cursor = arcpy.da.SearchCursor(parcel_class, pc_fields)
    poly_count = ['']
    for sc_row in sc_cursor:
        sc_extent = sc_row[0].extent
        for pc_row in pc_cursor:
            print("Working on: ", pc_row[1])
            pc_extent = pc_row[0].extent
            if fc_extent.crosses(pc_extent):
                print("Parcel {0}cross map {1}".format(pc_row[1], fc_row[1]))
    print("All done, here's the list: ", poly_count)
    return poly_count

In arcpy you can use the geometry of the polygon as well as the extent object of the dataFrame object to determine how many pages a given polygon is in.

Essentially you would loop over the data driven pages, get the page's extent and then perform a geometry operation between the polygon and the data driven page extent. In this case, if the polygon geometry object overlaps the extent of the data driven page then you could use a counter to store/count how many pages it overlaps.

| improve this answer | |
  • Thanks, is there a toolbox that does this, or do I need to write a script? – Mwspencer Sep 15 '17 at 16:54
  • You would need to write a script. – GeoSharp Sep 15 '17 at 16:59
  • Thank you, this will definitely test my ArcPy skills, as I am still new to the library ;). – Mwspencer Sep 15 '17 at 16:59
  • 1
    Good luck! I find the documentation for arcpy is excellent. – GeoSharp Sep 15 '17 at 17:03

I think a script for this could start by performing an Intersect between your polygon feature class and your Data Driven Pages index. Then use Summary Statistics to count the pages each polygon falls on before using a SearchCursor to start formatting the results.

| improve this answer | |
  • I confused on the difference between the intersect, crosses, and touches functions. Will one of the three out-perform the others for my situation, I'm running into runtime errors. My parcel lists are just too long. – Mwspencer Sep 15 '17 at 21:13
  • I'm talking about the Intersect geoprocessing tool. I would expect parcel lists into the millions would work fine. – PolyGeo Sep 15 '17 at 21:14
  • I see, so rather than creating a nested loop, I am just counting the number of indexes a parcel falls on. Therefore I would only have one loop and it would be the Parcel list. – Mwspencer Sep 15 '17 at 21:38
  • 1
    Not sure about the loops you are mentioning. Just perform the Intersect and look at the output attribute table there will be one part parcel for every polygon/sheet in the index feature class. Then when you run Summary Statistics on that and group by your parcel identifier field it will put a FREQUENCY field into its output so you will have the two columns that I think you are after: parcel identifier and count (FREQUENCY). – PolyGeo Sep 15 '17 at 23:31

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.