At its simplest, raster symbolizers are paint-by-numbers. A raster file is just a rectangular collection of pixels and each pixel has some value assigned to it (some times called a DN or digital number). The raster symbolizer maps RGB color space values to pixels in a colormap or look-up table (LUT); e.g. pixels with a value of 0 are mapped to #000000. In SLD this looks like <ColorMapEntry color=”#000000” quantity=”0″/>.
Simone has a couple of blog posts on GeoServer's raster symbolizer that are helpful:
Design
These wireframes are an extension of the proposal for vector styling in GeoExplorer. Ideally, the dialogs can be reused for Styling feature quantities (vector data).
Ball Parks
Prerequisites
- Support for RasterSymbolizer and ColorMap in OpenLayers (16hr)
- Styler4GeoExplorer Application Tasks (22hr)
- Styler4GeoExplorer OpenLayers Prerequisites (16hr)
Ballpark: 54hr
Styles Tab (1.2)
The rules in the Rules fieldset are fake rules, because they are represented in a color map. 1.2b would only be possible for vector layers with real rules. 1.2c and 1.2d represent the contents of a colormap and are possible for rasters. A view like 1.2b can be created for rasters as well, but we need to investigate if the ColorMap entries are upper or lower classbreaks or interpolation points for the color ramp.
- Set Values Fieldset with color ramp (4hr)
- Rules Fieldset (4hr)
- Add NoData ColorMap entry for rasters (1hr)
- ColorMap-Rules abstraction to make the same Rules Fieldset reusable for vectors (6hr)
Ballpark: 15hr
Classification Dialog (1.2.1)
This requires a server side component. If we go for a histogram, we need to be able to get the intervals and quanitities from the server. Without histogram, we still need the min and max values. For vector layers, we could calculate them on the client, but that's only practical for a small number of features. These ballparks only account for the client side and assume that the intervals and quantities come from the server.
- Number of intervals, interval type and attribute (vector layers only) dropdowns (4hr)
- Custom intervals: Histogram with slider (20hr)
- Unique values - only useful for a small number of features (2hr)
- Other interval types (equal interval, equal area, mean / std. deviation) - requires class breaks from the server (4hr)
Ballpark: 30hr
Use Cases
Below we'll cover the major functions as derived from the SLD spec.
Setting color tables/LUTs
There are basically two types of raster data, discrete and continuous data. Discrete data are groups of pixels that represent some phenomena, such as population density. Continuous data represent continuous variables such as elevation or imagery.
Discrete data corresponds to making choropleth maps and continuous data corresponds to making isopleth maps.
Use cases have to handle both types of data. In the case of discrete data, the UI should let the user to set colors for individual values. For continuous data, the UI should let the user set colors for ranges of values. There is no way, a priori, for a program to know if the data represents continuous or discrete values, so the user has to decide. We can guide the user by asking if the data is elevation data or imagery of some type and setting the appropriate interface.
There some default/standard color maps (LUTs) for some raster images. For example, Normalized Difference Vegetation Index (NDVI) is a common biomass indicator and has a standard colormap. Elevation can also be standardized, so it would be nice to provide default SLDs.
Classification
A nice tool to include would be a classification tool. This groups pixel values according to some algorithm which are typically, equal intervals (split equally in a specified number of groups), quantiles (unequally sized intervals, with equal amounts in each quantile), or standard deviation (classification by distance from the norm). These tools can be applied to both discrete and continuous data.
Setting stretches
In addition to setting RGB values, SLD can specify contrast stretches for imagery. You've used them before to improve the contrast of photos, but here is a lengthy but good discussion: Contrast Stretching and Density Slicing. I think SLD only supports Linear and Histogram equalization stretches for now.
Setting bands
Most people deal with imagery with a max of 3 bands (RGB) and alpha channel such as GeoTIFFs or 24-bit PNGs, but there will be people who do use multi-spectral data and want to have the option to set bands to the appropriate RGB channel.
A band is represents some wavelength or range of frequencies in the electromagnetic spectrum. Some are in the visible spectrum, some are not. For example Landsat bands 4,3,2 (in that order) correspond to RGB in the visible spectrum, so if you want to see the earth in true color, you would specify band 4,3,2 to correspond to RGB in the SLD. Combining bands in different orders also highlights different aspects of the image, for example Landsat bands 7,2,1 (none of which are in the visible spectrum) is very good for showing exposed mineral soil and urban areas and produces an image that is mostly green, purple and white.
Precedents
Attachments
- 20090901 Raster Symbology.png (97.6 kB) - added by rpenate 6 months ago.

