2

There seems to be no way to change the renderer using ArcPy.

Is there a workaround?

I am trying to show the RGB composite:

tif="test.tif"
newlayer=arcpy.mapping.Layer(rootDir+"\\"+tif)
# here is try to import a layer symbology to use, however it appears to have no effect on the output.
arcpy.ApplySymbologyFromLayer_management(newlayer, "C:\\mgmt\\tif_template.lyr")

arcpy.mapping.AddLayer(df, newlayer, "AUTO_ARRANGE")
  • FYI, I tried to use CopyRaster and CompositeBand functions with no apparent success. – jindurhur Jan 6 '17 at 17:02
1

Yes, there is a way to do this; you'll need to use arcpy.UpdateLayer (see link below). You’ll need to create a template layer file that uses RGB composite symbology (best to do this using the imagery you want to transfer symbology using ArcPy) and then use arcpy.UpdateLayer to apply the symbology in the layer file to the appropriate layer in your map document. The ArcGIS documentation has more detailed instructions.

  • This worked. workflow: -Create and template .lyr file with desired symbology. -Make and add new tif layer. -Use arcpy.mapping.Layer to access template layer properties. -Use updatelayer to update the tif layer with the template symbology. – jindurhur Jan 9 '17 at 18:51
  • would it work with just one .lyr file for multiple different .tifs, since I only need an instruction for it to update as RGB Composite? or do I have to create one for each image? – adamczi Jan 9 '17 at 20:46
  • Yes, you can use the same .lyr file to update multiple TIF layers. – IowaStatePython Jan 19 '17 at 21:49

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.