I have a map I am making where all I want to do is change the source layer for a raster to a new layer. I would then like to apply the same symbology as the original layer, but change the min and max values used to stretch the raster.
So far I have done this:
import arcpy
#load in aprx
aprx = arcpy.mp.ArcGISProject("in_aprx")
#get the maps
one = aprx.listMaps()[0]
#update the current raster with a new raster, this new raster has different min and max values which is what I ultimately want to change
one.updateConnectionProperties(original_layer, new_layer)
#save a copy
aprx.saveACopy("new_map.aprx")
I can access the layers symbology like so:
one_layers = one.listLayers()
one_layers[0].symbology
but I am not sure how to change the min and max values from here. As of now the minimum and maximum are being used from original_layer
which are very different and results in poor stretching.