0

Two times a year a positional check of railway assets is performed in ArcGIS Pro for 21 different areas by receiving updated data. Every half a year in each area new data is automatically prepared in a standardized structure and needs to be loaded in a new ArcGIS project file (.aprx). Therefore the file paths in the .aprx file should change to the new data based on the area and date. I know the .aprx files can be unzipped to show .xml files, but I am not sure of best way to edit all the filepaths to load the new data.

This problem is very similar to editing file paths in QGIS .qgz files.

How can I change the file paths in the .aprx file easily?

6
  • 2
    Hacking the .aprx is least easy option, when you can just use Python to change the layer definition.
    – Vince
    Feb 19 '20 at 13:43
  • Hi Vince. Thanks for your comment and solution, but I would like to change the layer definition without using ArcPy since ArcPy is not easily available on linux virtual machines or windows virtual machines on which the data is processed
    – Davma
    Feb 19 '20 at 14:12
  • 1
    I have not tried this but you could use python to rename the .aprx file extension to .zip, extract the contents of the zip, in the map folder re-write the layer xml and change the WorkspaceConnectionString and Dataset tag values to point to a new database/layer location/layer name, then zip up all the files, and rename the .zip file back to .aprx.
    – artwork21
    Feb 19 '20 at 14:42
  • Thanks artwork21. That seems to be a solution that can be implemented on a linux virtual machine
    – Davma
    Feb 19 '20 at 14:47
  • Update: I was able to unzip the .aprx file, see all the filepaths in the xml files and edit the filepaths, but I was not able to zip the .aprx file back together, because there seems to be protection on the .aprx file. Perhaps somebody else can figure out how to zip .aprx files back together. ArcPy also was not able to change the filepaths due to an unsolved bug.
    – Davma
    Mar 14 '20 at 10:40
0

Workaround solution which worked: use .aprx file with relative filepaths (./layername.shp), keep .aprx files and data in same directory and only change the name of the .aprx file for each area.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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