A ColorMap is a Symbolizer used to style Rasters by mapping pixel values to colors.
You can create a ColorMap from a List of Maps with color and quantity keys (opacity and label keys are optional):
def colorMap = new ColorMap([[color: "#008000", quantity:70], [color:"#663333", quantity:256, opacity: 0, label: "NO DATA"]])
Or you can create a ColorMap for a Raster from a ColorBrewer color palette:
def colorMap = new ColorMap(raster,"Greens", 5)
Or you can create a ColorMap for min and max values from a List of Colors:
def colorMap = new ColorMap(min, max, Color.getPaletteColors("Greens", 5))
Fields inherited from class | Fields |
---|---|
class Symbolizer |
filterFactory, styleBuilder, styleFactory, styleOptions |
Constructor and description |
---|
ColorMap
(java.util.List values, java.lang.String type = "ramp", boolean extended = false) Create a new ColorMap |
ColorMap
(Map map) Create a new ColorMap. |
ColorMap
(Raster raster, java.lang.String palette, int numberOfCategories, int band = 0, java.lang.String type = "ramp", boolean extended = false) Create a ColorMap for a Raster with a palette of colors (from Color Brewer) with the given number of categories |
ColorMap
(double min, double max, java.lang.String palette, int numberOfCategories, java.lang.String type = "ramp", boolean extended = false) Create a ColorMap for a min and max values with a palette of colors (from Color Brewer) with the given |
ColorMap
(Raster raster, java.util.List colors, int band = 0, java.lang.String type = "ramp", boolean extended = false) Create a ColorMap for a Raster from a list of colors |
ColorMap
(double min, double max, java.util.List colors, java.lang.String type = "ramp", boolean extended = false) Create a ColorMap for min and max values with a List of colors |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
apply(Symbolizer sym) Apply this Symbolizer to the GeoTools Symbolizer |
|
protected ColorMap |
generateColorMap(java.util.List<java.util.Map> values, java.lang.String type, boolean extended) Generate a GeoTool's ColorMap from A List of Maps with color, opacity, quantity, and label keys |
|
protected void |
prepare(Rule rule) Prepare the GeoTools Rule by applying this Symbolizer |
|
java.lang.String |
toString() The string representation |
Methods inherited from class | Name |
---|---|
class RasterSymbolizer |
apply, geometry, opacity, overlap, prepare, setGeometry, setOpacity, setOverlap, toString |
class Symbolizer |
and, apply, asSLD, asSLD, buildString, composite, createGeoToolsSymbolizer, getDefault, getDefault, getGeoToolsSymbolizers, getGtStyle, getSld, plus, prepare, prepare, range, range, sortBy, sortBy, where, zindex |
Whether to use extended colors or not
The ColorMap type (intervals, values, ramp)
A List of ColorMap values
Create a new ColorMap
values
- A List of ColorMap valuestype
- The typeextended
- Whether to use extended colorsCreate a new ColorMap.
map
- A Map of named parameters.Create a ColorMap for a Raster with a palette of colors (from Color Brewer) with the given number of categories
raster
- The Rasterpalette
- The color palette name (from Color Brewer)numberOfCategories
- The number of categoriesband
- The band to use for min and max valuestype
- The type of interpolationextended
- Whether to use extended colorsCreate a ColorMap for a min and max values with a palette of colors (from Color Brewer) with the given
min
- The min valuemax
- The max valuepalette
- The color palette name (from Color Brewer)numberOfCategories
- The number of categoriestype
- The type of interpolationextended
- Whether to use extended colorsCreate a ColorMap for a Raster from a list of colors
raster
- The Rastercolors
- The list of colorsband
- The band The bandtype
- The type of interpolationextended
- Whether to use extended colorsCreate a ColorMap for min and max values with a List of colors
min
- The min valuemax
- The max valuecolors
- The list of colorstype
- The type of interpolationextended
- Whether to use extended colorsApply this Symbolizer to the GeoTools Symbolizer
sym
- The GeoTools SymbolizerGenerate a GeoTool's ColorMap from A List of Maps with color, opacity, quantity, and label keys
values
- A List of MapsPrepare the GeoTools Rule by applying this Symbolizer
rule
- The GeoTools RuleThe string representation
Groovy Documentation