How to reference Map document parameter in ArcGIS Pro?

1469
4
08-08-2016 05:39 AM
JohnSolly1
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
JakeSkinner
Esri Esteemed Contributor

Hi John,

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

aprx = arcpy.mp.ArcGISProject(r"C:\Projects\blank.aprx")
aprx.importDocument(r"C:\Projects\YosemiteNP\Documents\Yosemite.mxd")

You can then export the layout to PNG:

Layout—ArcPy | ArcGIS for Desktop

RebeccaStrauch__GISP
MVP Emeritus

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
JakeSkinner
Esri Esteemed Contributor

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

0 Kudos
DanPatterson_Retired
MVP Emeritus

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

0 Kudos