AnsweredAssumed Answered

Different default symbology in arcmap when loading rasters

Question asked by muellea on Jan 8, 2019
Latest reply on Jan 9, 2019 by muellea

I wrote some script tools to extract several rasters from a dem and load, order and draw them in a group layer. Extractions happens with RasterCalculator_sa and SetNull, so all Rasters have one constant value=1. When loading these rasters back into an empty document, I get different results in terms of symbology types on different machines (all 10.6.1).

Machine A loads with symbology type "Stretched", while Machine B with Symbology "UniqueValues". Because I need to set the same symbology to these layers with arcpy, this causes trouble when i use ApplySymbologyFromLayer_management to do that (You can't aply a symbology layer with a different symbolgy type).

Rasters are stored with unsigned integer in a file geodatabase with raster.save:

 

    rastemp = arcpy.gp.RasterCalculator_sa('("%s"  %s)*%s'%(raster_layer, queryTuple[1], queryTuple[0]))

    raster1 = arcpy.sa.SetNull(rastemp,1,"Value=0")

    raster1.save(outputname)

 

and later loadeds into a group layer:

    result = arcpy.MakeRasterLayer_management(raster_workspace + "\\%s"%inputname, shortname)

    arcpy.ApplySymbologyFromLayer_management(layer, symb_layer)

    arcpy.mapping.AddLayerToGroup (df, group_lyr, layer)

 

These are only code snippets, but I think, it's not a problem with scripting, but with a different environment or something like that. Any suggestions?

Attachments

Outcomes