The counterpart of that in ArcMap is arcpy.mapping.exportToPNG(),
but i could not find the substitute in Arcpy.mp in arcgis pro
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 <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mp<SPAN class="punctuation token">.</SPAN>ArcGISProject<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CURRENT"</SPAN><SPAN class="punctuation token">)</SPAN> map <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listMaps<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> map<SPAN class="punctuation token">.</SPAN>defaultView<SPAN class="punctuation token">.</SPAN>exportToPNG<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Please mark a response as Correct to close out the question.
Thank you! This is just what I need!
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.
See the code samples in
Layout—ArcGIS Pro | Documentation
Of course, it will only work if you have one or more layouts
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()
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
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.