0

I am using ArcGIS Pro for my map automation. I try to use arcpy.mp module to identify the maps in the current project. I want to export the map into a jpeg image like what we can do via Map Export under Share tab. But I didn't find any relevant methods under map object and as to my research, either layout or MapFrame could have method exportToJPEG. below is my code so far and no layout in my current project.

How can I use Python to convert a map object to MapFrame or layout object for exporting as an image or any other way to achieve my purpose?

aprx = 
arcpy.mp.ArcGISProject(r"C:\Users\Documents\ArcGIS\Projects\myProject.aprx")

mps = aprx.listMaps()

lyr = mps[0].listLayers()

aprx.listLayouts()
3

As you have found in the documentation there are exportToJPEG methods on both Layout and MapFrame classes but not on the Map class.

It is not possible to use ArcPy to create a map, map frame or layout in an ArcGIS Pro project, nor is it possible to clone them (like you can for Layout Elements like Text and Graphic Elements).

Consequently, if you want to see the layer(s) in a map exported to JPEG using ArcPy then you will need to author an ArcGIS Pro project with that map in a map frame on a layout first.

You can then use ArcPy to add/remove layers from that map, to alter layer visibility, etc prior to exporting the map frame or layout to JPEG.

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.