Mapseries dataframe 'exportToGIF' with arcpy in ArcGIS Pro

973
4
08-10-2020 09:43 AM
DávidGregor
New Contributor II

I'm migrating to arcgis pro, and i cannot find working documentation about this problem.

I'd like to export only the dataframe of the layout, i commented out the old method. Any idea? It's a printing tool for many map series projects with more layouts.

p = arcpy.mp.ArcGISProject(pPath)
      for l in p.listLayouts():
      fileName = l.name
      ms = l.mapSeries
      #df = arcpy.mapping.ListDataFrames(p, "Layers")[0]
           for pageNum in range(1, ms.pageCount + 1😞              
                if outFormat == "GIF" and noFrame == "true":
                     #l.exportToGIF(pdfRootName +"_"+ gifpageName + "_data.gif", df, df_export_width=2560df_export_height=1920)
                     l.exportToGIF(destination + "\\" + gifpageName + ".gif", clip_to_elements=True, resolution=300)
0 Kudos
4 Replies
DávidGregor
New Contributor II

So... I could squeeze out an invalid gif file (green nothing)

p = arcpy.mp.ArcGISProject('current')
l = p.listLayouts()[0]
mapframe = l.listElements('MAPFRAME_ELEMENT')[0]
print(mapframe.name)
#mapframe.exportToGIF("D:\\arcgis_data\\Migrate\\pageName.gif")

but it's still not mapseries export.

0 Kudos
DanPatterson
MVP Esteemed Contributor

MapFrame—ArcGIS Pro | Documentation 

Did you try png? since gif is considered legacy and only supports limited color (256 colors (8-bits per pixel), )


... sort of retired...
0 Kudos
DávidGregor
New Contributor II

PNG export worked, but it created a  27000x19000px file.. (probably it's the full extent of the map.)

So do you think it's not possible to export gif from map series only with the dataframe's content, like datadrivenpages worked?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

According to Export a map series—ArcGIS Pro | Documentation :

After creating a map series, you can export it as a file to share with others. Exporting to PDF exports all the pages in a map series and provides options for the export process. For example, you can export all pages in a single operation, export each page as an individual file, or export all the pages into a single, multipage PDF document. When you export to a file format other than PDF, such as PNG, only the map series page currently visible in the map extent is exported.

Map series only export as map series if you export to PDF, exporting to any other format results in a single page being exported.