A raster styling consists of the style of the raster data itself and the style of the data bounds. The data bounds are displayed if the raster data is not suited for the current view, when the data is too detailed for a zoomed-out view for example.

This article discusses the use of TLspRasterStyle to style raster data. If you are using the LuciadLightspeed image processing framework to process your raster data as ALcdImage instances, you can use TLspRasterStyle in conjunction with TLspImageProcessingStyle. TLspImageProcessingStyle allows you to apply the image operators of the image processing framework during visualization. TLspRasterStyle can serve to adjust brightness, contrast, and opacity of the image processing result. For more information about TLspImageProcessingStyle, see How to model raster data for image processing.

Styling raster data with TLspRasterStyle

You can use TLspRasterStyle to define the style of raster data. The elevation mode of this style is ON_TERRAIN by default.

You can change the point at which the raster data or its bounds are visualized by setting the startResolutionFactor.

Note that you need to set a ColorModel on the style if you want to visualize elevation data as a colored texture on the terrain. Otherwise, the elevation data will only be used to elevate the terrain. For more information about customizing the terrain visualization itself, see Terrain visualization.

lsp rasterdatastyle
Figure 1. Elevation raster data styled with TLspRasterStyle

Styling the raster data bounds: TLspLineStyle and TLspFillStyle

You can use TLspLineStyle and TLspFillStyle to define the appearance of the raster data bounds. Note that you typically need to enable draping on the style explicitly.

lsp rasterboundsstyle
Figure 2. Raster data bounds styled with TLspLineStyle and TLspFillStyle

Color manipulation using TLspColorLookupTableFilterStyle

You can manipulate the colors of a raster layer by adding a TLspColorLookupTableFilterStyle to the layer. This style defines one or more color lookup tables, which are indexed using the red, green and blue components of the pixels in the raster, and which produce a new color as output. The color lookup is performed on the GPU, and therefore has very little performance cost.

Color lookup tables allow for a wide variety of image processing operations, such as:

  • Brightness and contrast adjustments

  • Replacing one color with another, making all black pixels in a raster transparent for example

  • Swapping color channels, converting BGR to RGB for example

For more details, see the reference documentation of the com.luciad.view.lightspeed.style.filter package and TLspRasterLayerBuilder class.

As mentioned above, you can perform more elaborate image processing, including color lookup operations, by using TLspImageProcessingStyle. For more information, see How to model raster data for image processing.