I am trying to add a raster layer in ArcPy with arcpy.mapping.Layer(Raster). By default, the layer is added with "Stretched" symbology. However, for further use of the raster, I need "Unique Values" instead.
Is there a way to directly add a Layer with the predefined symbology "unique value" to the default map document in ArcPy?
So far I have tried to change the symbology with symbologyType, but it does not seem to work.
arcpy.gp.Reclassify_sa(ReclassifyFilteredAccumulation, "Value", "1 1;NODATA 0", ReclassifyVectorize, "DATA") VectorizeLayer = arcpy.mapping.Layer(ReclassifyVectorize) if VectorizeLayer.symbologyType == "UNIQUE_VALUES": VectorizeLayer.symbology.valueField = "VALUE" VectorizeLayer.symbology.addAllValues() arcpy.mapping.AddLayer(df, VectorizeLayer,"BOTTOM")