Select to view content in your preferred language

Change color ramp in raster outputs

3318
3
07-01-2013 11:50 AM
GualbertoHernandez
Emerging Contributor
Hi all,

I'm generating a process where I use "copyraster" but I get as output rasters with grayscale color (color ramp "black to white") and I need to get them in color, in the color ramp "Brigth Full-Spectrum", know if is this possible in python?.

Thank you for your help.
Gualberto
Tags (2)
0 Kudos
3 Replies
ShaunWalbridge
Esri Regular Contributor
You can do this using arcpy.mapping, which exposes many of the symbolization options via Python. Check into RasterClassifiedSymbology, which should let you do what you need. First, save a .lyr file with the palette you'd like to use, then use arcpy.mapping.updateLayer to apply the symbology to your layer, and finally perform reclassification (e.g. lyr.symbology.reclassify())or other changes to make the color map match the input data.

cheers,
Shaun
0 Kudos
RhettZufelt
MVP Notable Contributor
Your raster is a raster, it is the symbology chosen in your mapping application that determines what "colors" are assigned to which raster value.

I am assuming you are using ArcMap to view your created rasters.  you should be able to open the ArcMap Advanced Settings Utililty, go to the Raster tab and set the default resampling mode, then go to the Symbols/Graphics tab and set the Default color Ramp to the one you want.  Then close ArcMap and re-open.  Now, when you add rasters to it, it should, by default, load with the color ramp and resampling mode that you set as the default in the settings.


R_
0 Kudos
markdenil
Frequent Contributor
You can assign a colormap, but that only applies to certain types of rasters,
and it only assigns colors to specified unique values.

If you save a rendered raster (one with your desired symbol schema applied) as a layer file,
you can use Apply Symbology From Layer (Data Management).
0 Kudos