Automating Map Series Pages in ArcGIS Pro With Python

5806
7
03-24-2016 04:40 PM
SeanFadum1
New Contributor III

I was wondering if anyone has come across any documentation to access the Map Series Pages in ArcGIS Pro via ArcPy.  I thought this would have been part of the mapping module.  Can this be done, or is it something coming in future releases.?

Thanks.

0 Kudos
7 Replies
RebeccaStrauch__GISP
MVP Esteemed Contributor
SeanFadum1
New Contributor III

Thanks Rebecca, however those links don't seem to cover what I am looking for.  I'm wondering how to access and export the pages in a Map Series.... something similar to the functionality  of the arcpy.mapping.datadrivenPages class.

0 Kudos
RebeccaStrauch__GISP
MVP Esteemed Contributor

Hmm.  so I guess this sums it up for now then...

20045: Data Driven Pages are not yet supported—ArcGIS Pro | ArcGIS for Desktop

Not real helpful on a time line or if they will be supported.....but sounds like for know you are out of luck.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Yes... it was promised for the PRO 1.2 releases (some workarounds given)

Data Driven Pages in ArcGIS Pro (Customization)

but now called map series ( but still can't find a definitive.... yes... ddp is now map series... quote0

Finding data driven pages for ArcGIS Pro? - Geographic Information Systems Stack Exchange

Map series—Layouts | ArcGIS for Desktop

I suspect that the pdfdocument and associated materials is what you are looking for

PDFDocument—ArcPy | ArcGIS for Desktop

Migrating from arcpy.mapping to ArcGIS Pro—ArcPy | ArcGIS for Desktop

ArcGISProject—ArcPy | ArcGIS for Desktop begin here for classes

PDFDocumentCreate—ArcPy | ArcGIS for Desktop how to create pdf

BrandonFlessner
Occasional Contributor

I'm looking for a way to automate the export of each page in a map series to a png or jpeg. This is possible with data driven pages in ArcMap - but doesn't appear to be possible in Pro (1.4). From the docs:

" If you have a map series enabled and export to a format other than PDF (for example, JPG), you'll only generate a single page output file. If you want a JPG file for every page in the map series, you'll need to manually display and export each page."

**Insert complaints and griping here**

Any workarounds?

0 Kudos
SeanFadum1
New Contributor III

Hi Brandon,

I too am looking to automate jpg exports from a Map Series and so far have nothing (admittedly I have wasted my time on this in a while)  The only workaround I can think of is:

1) instead of using map series, create the extents of your maps manually and bookmark them

2) in python, loop through your bookmarks (setting the extent of your maps) and then export each one as jpeg

This is just a thought, and I have not tested / investigated the feasibility of it.  If you try it, please let me know how it turns out for you.

Hope they just update the Arcpy module to handle this properly in the fall release of ArcGIS Pro (1.5)

Cheers,
Sean

0 Kudos
DavidWasserman
Regular Contributor

I realize this is old, but I am working with this now in pro. I thought I would share my code sample, and report that within the ArcGIS Pro interface itself I am finding garbage collection issues related to image exports at the scale of 1000 images. 

 

aprx = mp.ArcGISProject(project)
layout = aprx.listLayouts(layout_name)[0]
map_frame = layout.listElements("MAPFRAME_ELEMENT")[0# Use First one
PLM.arc_print("Working with layout {0}".format(layout.name))
field_tuple = ("SHAPE@"PLM.arc_print("Starting image export. Check if images are blank. If they are, the Map Frame Projection "
              "should be set to match the projection of the labeled feature class.")
with arcpy.da.SearchCursor(in_features, field_tuple) as curs:
    for row in curs:
        counter += 1
        shape = row[0]
        image_name = str(base_name) + "_" + str(counter) + ".jpg"
        image_path = os.path.join(output_folder, image_name)
        extent = shape.extent
        map_frame.panToExtent(extent)
        if counter % 100 == 0:
            PLM.arc_print("Exporting JPEG at feature number {0}.".format(counter))
        layout.exportToJPEG(image_path)

Running something like this outside of ArcGIS Pro seems to work best, but maybe this will be helpful for someone trying to automate these workflows. 

David Wasserman, AICP