0

I regularly have large series' of maps/layouts in ArcGIS Pro which I need to export for various different documents, but each layout has a required text element in it that states what document it's bound for (e.g. Technical Report, Outreach, Summary, etc.).

Rather than having to open each layout, make that one small edit, then export to jpeg, which takes forever, I want to make a tool/model in ArcGIS Pro where I can select the layouts, which are then batch edited to change that text element, then exported as jpegs.

I've discovered that I can directly open the .pagx layout files in notepad and edit the Text Element in that, so I was thinking about starting with a script that searches the files for the text element to edit/replace, does so, saves them as new layout files in a set file location, and then passes the new files to a tool for export as jpeg.

Unfortunately, my coding skills lie in R, not Python, so I'm not really sure how to use ArcPy (?) to do this.

1
  • I would seek to do the processing through CIM as suggested by @Xeppit as editing files through some text editor like notepad in my opinion is asking for trouble as you could very easily corrupt the file, e.g. drop of a } for example. Accessing through an object model may require more code but it is robust as you can trap for errors. I would also add what you want to do is not directly possible in modelbuilder you will have to script in python to access the CIM object model of a project.
    – Hornbydd
    Feb 23 at 12:17

1 Answer 1

1

In ArcGIS Pro .lyrx, .mapx, and .pagx. are a json format which you can manipulate with python. That is the reason you can open it in a text editor. Esri call it CIM - Cartographic Information Model.

It is a map content specification used to document how information that describes various project components is persisted when saved, read, referenced, or opened. The specification is represented as JSON and is used for maps, scenes, layouts, layers, symbols, and styles in ArcGIS applications and APIs.

You can find a documentation here:

https://pro.arcgis.com/en/pro-app/3.1/arcpy/mapping/python-cim-access.htm

I didn't try it in ModelBuilder when I manipulate data I just use it in python load the json, manipulate the data and write it back or save as new .mapx or .lyrx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.