Skip to main content
added 22 characters in body
Source Link

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

something like this?

colormap = open("colormap.clr", "w") colormap.write("1 70 137 102\n102\n") colormap.write("2 255 176 59\n59\n") colormap.close() 

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

something like this?

colormap = open("colormap.clr", "w") colormap.write("1 70 137 102\n) colormap.write("2 255 176 59\n) 

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

something like this?

colormap = open("colormap.clr", "w") colormap.write("1 70 137 102\n") colormap.write("2 255 176 59\n") colormap.close() 
added 142 characters in body
Source Link

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

something like this?

colormap = open("colormap.clr", "w") colormap.write("1 70 137 102\n) colormap.write("2 255 176 59\n) 

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file).

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy?

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

something like this?

colormap = open("colormap.clr", "w") colormap.write("1 70 137 102\n) colormap.write("2 255 176 59\n) 
deleted 7 characters in body; edited title
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

Apply Applying symbology to raster layer in arcpyArcPy without using a symbology layer (layer file)?

Say I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file). Is this possible in arcpy? 

Is it possible to create a color map or symbology layer (layer file) entirely in arcpyArcPy? 

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in arcpyArcPy, if possible.

For clarification:

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

Apply symbology to raster layer in arcpy without using a symbology layer?

Say I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer. Is this possible in arcpy? Is it possible to create a color map or symbology layer entirely in arcpy? I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer or colormap - I would like the colors to be selected entirely in arcpy, if possible.

For clarification:

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 

Applying symbology to raster layer in ArcPy without using symbology layer (layer file)?

I have a raster layer with 3 unique values (1,2,3) and I want to apply a unique color to each using RGB values or hex codes, without the use of a symbology layer (layer file). 

Is it possible to create a color map or symbology layer (layer file) entirely in ArcPy? 

I want my code to add the raster layer to the map with the symbology I want (as opposed to random), but I don't want to use a pre-created symbology layer (layer file) or colormap - I would like the colors to be selected entirely in ArcPy, if possible.

arcpy.MakeRasterLayer_management(cat, "cat") arcpy.SaveToLayerFile_management("cat", "cat.lyr", "ABSOLUTE") mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] arcpy.mapping.AddLayer(df, "cat.lyr", "TOP") # this is where I want to apply unique colors to each pixel value (pixel values are: 1,2,3) # but I don't want to use add colormap or apply symbology from layer, unless the symbology # layer or colormap can be created entirely in arcpy. I would like the color decisions # to be made entirely in arcpy, without having to make a symbology layer or colormap # in the GUI arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df 
added 759 characters in body
Source Link
Loading
edited title
Source Link
Loading
edited title
Link
Loading
added 3 characters in body
Source Link
Loading
Source Link
Loading