I have a map which has two insets which looks like this:

enter image description here

The first map frame is in the upper left and the second is all of the background. Using my exact same map layout as shown here I just want to update the pathway of a layer.

For example, I am just trying to update one layer here, and that is the raster of Alaska shown in the upper left.

I am trying to update the layer like this:

#load in the map
aprx = arcpy.mp.ArcGISProject("my_project")

#get the first map frame
one = aprx.listMaps[0]

#get the layers in that frame
one_layers = one.listLayers()

#list all the pathways
for layer in one_layers:

     print (layer.dataSource)

This returns four layers which are the correct pathways for that map frame.

I want to replace one called "/Users/user/Fall/sen.tif" to "/Users/user/Spring/sen.tif"

I am trying to do this like so:

aprx.updateConnectionProperties("/Users/user/Fall/sen.tif", "/Users/user/Spring/sen.tif")

#save new layout

I have also tried:

one_layers[2].updateConnectionProperties("/Users/user/Fall/sen.tif", "/Users/user/Spring/sen.tif")

where [2] is the layer location I want to replace but it is the same outcome.

but when I load the new map the layer was not updated. My desired output is an updated layer with the same symbology as before applied.

1 Answer 1


The updateConnectionProperties function works on the following objects: ArcGISProject, Layer, LayerFile, Map, and Table classes.

It looks like you are trying to run it on individual files, eg. the *.tif images.

Try removing the "/sen.tif" from your code:

aprx.updateConnectionProperties("/Users/user/Fall/sen.tif", "/Users/user/Spring/sen.tif") 


aprx.updateConnectionProperties("/Users/user/Fall", "/Users/user/Spring")
  • That still didn't work, but there are numerous tif files in both /Users/user/Fall and /Users/user/Spring Commented Oct 8, 2018 at 18:15
  • So the function doesn't work on file directories/folders...maybe copy the *tif files into respective Feature Datasets inside a file geodatabase, and then try the function. Also, Commented Oct 8, 2018 at 18:22
  • Also, this ---> #save new layout aprx.saveACopy("/Users/user/new_map.aprx") dosnt't save a new layout; it saves a new ArcGIS Pro project... Commented Oct 8, 2018 at 18:29
  • Anyway, something like this might work: import arcpy aprx = arcpy.mp.ArcGISProject(r'C:\Projects\MyProject\my_project.aprx') aprx.updateConnectionProperties(r'C:\Projects\MyProject\Fall.gdb', r'C:\Projects\MyProject\Spring.gdb') aprx.saveACopy(r'C:\Projects\MyProject\my_project_copy.aprx') del aprx Commented Oct 8, 2018 at 18:29
  • creating respective fgdbs for each set of *.tifs, then change path to each fgdb... Commented Oct 8, 2018 at 18:30

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.