The counterpart of that in ArcMap is arcpy.mapping.exportToPNG(),
but i could not find the substitute in Arcpy.mp in arcgis pro
Solved! Go to Solution.
There are exportTo... methods bound to MapView—ArcGIS Pro | Documentation. Either use the activeView property of an ArcGISProject or the defaultView property of a specific map.
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
map.defaultView.exportToPNG()
From
Map—ArcGIS Pro | Documentation
A map can also be accessed from a MapFrame object using the map property. Note: arcpy.mp does not provide access to map views within the application; it only provides access to MapFrames.
perhaps
MapFrame—ArcGIS Pro | Documentation there is export to png there
Plus other salient bits of information beginning here
Migrating from arcpy.mapping to ArcGIS Pro—ArcGIS Pro | Documentation
Thank you for your reply!
The documentation says that:
the method of ListElements on Layout Objects can get access to MapFrame
But when the scirpt below return a null list, do you know the reason?
pro = arcpy.mp.ArcGISProject("CURRENT")
mp = pro.listLayouts()
See the code samples in
Layout—ArcGIS Pro | Documentation
Of course, it will only work if you have one or more layouts
But I don't want to export my layouts. I just want to export my map Object into a PNG file which comes from a .shp file. In the interface, I only need to click on the map icon and click on sharing, then I can export your map into a PNG file, which means map file can be directly exported into a png. But I couldn't find that function in Map class in the documentation.
There are exportTo... methods bound to MapView—ArcGIS Pro | Documentation. Either use the activeView property of an ArcGISProject or the defaultView property of a specific map.
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
map.defaultView.exportToPNG()
Thank you! This is just what I need!
Please mark a response as Correct to close out the question.