How to reference Map document parameter in ArcGIS Pro?

08-08-2016 05:39 AM
New Contributor II

I am trying to save the following python script as a tool to be incorporated into modelbuilder within Pro:

mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")

arcpy.mapping.ExportToPNG(mxd, r"C:\Project\Output\Project.png")

It works in ArcMap but I'm not sure how to do it in Pro since it does not use .mxd files.

How can I access the map document in Pro and run a tool that traditionally uses an .mxd?

0 Kudos
4 Replies
Esri Esteemed Contributor

Hi John,

ArcGIS Pro works with projects (.aprx).  You can import your current MXD to a blank aprx.  Ex:

aprx ="C:\Projects\blank.aprx")

You can then export the layout to PNG:

Layout—ArcPy | ArcGIS for Desktop

MVP Esteemed Contributor

Jake, for some reason I'm getting an error on you link.

thus might be what you were going for  Export a map or layout—ArcGIS Pro | ArcGIS for Desktop

0 Kudos
Esri Esteemed Contributor

Thanks, Rebecca.  I went ahead and added it manually.

0 Kudos
MVP Esteemed Contributor

apparently linked to modelbuilder too Reference .mxd parameter in ArcGIS Pro's modelbuilder?

0 Kudos