Skip to end of metadata
Go to start of metadata


Improve GeoTools support for the SLD Raster Symbolizer.


Simone Giannecchini, Alessio Fabiani



Refactoring the actual Raster Symbolizer architecture / Implementing the needed functionalities

Implement RasterSymbolizer support for the GeoTools rendering system.


RasterSymbolizer defines a set of rules on how the client can instruct the renderer to create a portrayal of raster data. It introduces a set of operations that a rendering engine can perform consequently on raster data, like band selection, recolor, contrast enhancement and so on (see SE 1.1 and SLD 1.0 1.0 for reference).

The Current Situation

The actual GeoTools SLD Raster Symbolizer implementation is rather poor and takes in account a very limited set of operations. Currently, the Raster Symbolizer functionalities are provided basically by the RasterSymbolizerSupport class represented in the diagram below.

The RasterSymbolizerSupport class has basically one method (recolorCoverage()) which extracts the color-map  from the provided SLD's RasterSymbolizer element and tries to create a new set of Categories for the Coverage. Obviously, this approach only takes into account the ColorMap operation, also the result is not guaranted for all the cases, due to the fact that an input coverage may have no categories at all hence the recolorCoverage method may fail.

The Proposed Implementation

We describe here the approach we have followed to improve support for the RasterSymbolizer.

The work that has been performed can be summarized as follows:

  • check the SE 1.1 documentation for any changes relative to SLD 1.1 RasterSymbolizer
  • development of piecewise1D transformation support classes for performing generic transformation on raster bands.
  • development of coverage processing nodes implementing all the functionalities of the Raster Symbolizer as a processing chain.

The benefits are:

  • the SLD Raster Symbolizer basic operations supported are:
    • Channel Selection
    • Color Map
    • Contrast Enhancement
      • algorithms actually supported:
        • Histogram Normalize
        • Histogram Equalize (ONLY ON BYTE DATA for the moment)
        • Logarithmic Enhancement
        • Exponential Enhancement
    • Opacity
    • Gamma Correction 
  • this architecture allows to easily add more functionalities as needed, by simply implementing specific coverage processing nodes
  • piecewise transformations allow full control for raster classification

The diagrams below provides an overview of the proposed infrastructure for supporting piecewise transformation on raster values (click to enlarge diagram).

Here below the UML class diagram for the classes responsible for implementing SLD 1.0 rastersymbolizer (click to enlarge diagram). 

Depending on the type of the CoveerageProcessingNode, it can be nested at different levels and invoked at different steps of the processing chain. The structure of the proposed API allows a developer to chain nodes as desired. The execute method produces an output GridCoverage2D used as input for the next node on the chain.

In order to improve the raster classification using categories, a new RasterClassifier JAI operation is proposed. This class inspects the raster classifing the raw values and range of values into categories, like for instance No-Data, but also prepares the image layout of the portrayal taking into account the original sample model of the raster, which usually cannot be directly represented as an image.

Note that javadocs  for this work are attached.

Tests and Code Coverage 

As shown by the picture below particular care has been put on testing the provided capabilities. However, given the extensive refactor that this work has been undergoing lately to incorporate suggestions from the community we cannot guarantee to be 100% bug free (click to enlarge diagram). 


From the user point of view, the Raster Symbolizer intervention support is fully transparent since it is hidden within the GridCoverageRender. Let's show some example how usage.

Symbolizing Sea Bottom Data

The following code provides an example of applying raster symbolizer on a sea bottom coverage through parsing of an SLD file.

StyleBuilder can also be used to manually build the Raster Symboliser element, see below.

Here below the results of the code above with an input sonar image at which an Histogram Contrast Enhancement has been applied

Original Image

Symbolized Image

Applying SLD to DEM data

The SLD used:

Original Image

Gray Channel

Symbolized Gray Channel

An example using an input ASCII-Grid file produced by the SWAN processing

A snippet of the original file:

Portrayal using an SLD with no Color Map, Gray Channel selection and Histogram Contrast Enhancement:

Sample output:

Portrayal using an& SLD with Color Map and Gray Channel selection

Sample output:

Final Remarks

The proposed approach should be backward compatible, since it does not require any kind of intrusive intervent to the GridCoverageRenderer since it completely replace the old RasterSymbolizerSupport class.The diagram depicted at the beginning of the document will change as shown below


Actually the Raster Symbolizer stuff presented here, is implemented on the GeoTools 2.4.x-RS branch. In order to complete the proposal the code should be ported to eoTools trunk.

Voting has not started yet:

  • Chris Holmes



no progress






lack mandate/funds/time


volunteer needed

  1. Do a quick check to make sure the classes mentioned in the proposal
    are non public 
  2. (tick)  Implement the Raster Symbolizer support
  3. (question) Porting of the RS stuff on GeoTools 2.4.x
  4. Porting of the RS stuff on GeoTools trunk
  5. Copy the examples on this page over ot the user guide
  • No labels