Update datasources of .pagx files with Python

844
2
08-09-2021 04:24 PM
Labels (1)
GeoNZ
by
Occasional Contributor

I'm writing a python tool to update datasources in multiple ArcGIS pro related files from a network location to a local drive. 

With ArcGIS Projects (.aprx) files, this is fine as there are methods on the project/map to update datasources. For layout files- (.pagx) which we use for standardised templates imported into the users prodject using another custom python tool, there is no such methods.

 

How can I bulk update .pagx layouts? Is it possible to generate a temporary ArcGIS pro project in memory, import the layout, update datasources, re-export the pagx?

0 Kudos
2 Replies
JeffBarrette
Esri Regular Contributor

Hello Timothy,

We do have in our future plans to support directly updating data sources in pagx/mapx files but in the meantime there is an easy work around.

Import the pagx into an existing project, change the data sources using the techniques documented and then use Layout.exportToPAGX (or Map.exportToMAPX) to overwrite your existing file.

Jeff - Layout and arcpy.mp teams

0 Kudos
GeoNZ
by
Occasional Contributor

Thanks for the reply Jeff- I'll try this, but have a feeling I may run into issues importing multiple pagxs into the same project (as there's no way to programmatically 'clean up' as I go by deleting those layouts and maps)

0 Kudos