HOW TO
Since ArcView Spatial Analyst does not apply colormap files (.clr) to grid themes, you can use the following script to create a new legend classification scheme based on a colormap file. The new scheme will be available in the grid theme's legend editor.
Note:
This script modifies the nc_ramps.odb file. You can reset the legend schemes by replacing the new file with the original.
Code:
'-- This script will read a grid colormap (.clr) file and
'-- create a new scheme out of it. After restarting ArcView,
'-- the new scheme can be applied to the grid in the legend editor.
'
' Warning: This script will modify the default color schemes for ArcView.
' Make a backup copy of $AVHOME/etc/nc_ramps.odb before running
' this script.
NewScheme = SymbolList.Make
rgb_name = FileDialog.Show("*.clr", "Grid .clr files", ".clr to Scheme")
if (rgb_name = nil) then exit end
rgb_file = LineFile.Make(rgb_name, #FILE_PERM_READ)
num_syms = rgb_file.GetSize
for each s in 1..num_Syms
buf = rgb_file.ReadElt
if (buf = nil) then
continue
elseif(buf.contains("#")) then
continue
elseif(buf = "") then
continue
else
if(buf.contains(",")) then
atoken = ","
else
atoken = " "
end
tokens = buf.AsTokens(atoken)
r = tokens.Get(1).AsNumber
g = tokens.Get(2).AsNumber
b = tokens.Get(3).AsNumber
nc = Color.Make
nc.SetRGBList({r,g,b})
NewScheme.Add(nc)
end
end
rgb_file.close
NewSchemeName = Msgbox.Input("Enter a Name for your new Scheme:",
"Add a Scheme","New Name")
NewScheme.SetName(NewSchemeName)
Schemes = ODB.Open("$AVHOME/etc/nc_ramps.odb".AsFileName)
Schemes.Add(NewScheme)
Schemes.Commit
msgbox.info("Please restart ArcView for this new scheme to be" +
" recognized.","Restart ArcView")
Article ID:000003536
Get help from ArcGIS experts
Download the Esri Support App