Using the RAT Module

The RAT modules adds facilities to explore a Raster Attribute Table, and generate styles based on a classification column of choice.

If the source raster contains a RAT, a new panel will appear in the Publishing tab of the layer.

../../_images/rat_panel.png

The table allows for exploration of the attribute table, while the toolbar at the top allows to generate styles based on the table contents:

  • The Band dropdown allows to select a raster band.

  • The Classification dropdown allows to select a column to use for classification.

  • The Style name controls the name of the style to be generated. It’s automatically filled with a naming convention of <layer>_b<band>_<classification>, but can be customized.

  • The Create style button generates the style based on the chosen classification, eventually using colors if available in the table, otherwise generating random colors. The geneated style will also be included among the “alternate styles” of the layer.

The generated style will match all the values in the raster attribute table, and ensure the chosen classification column is used for both styling, legend generation, and GetFeatureInfo output.

Here is an example style:

 1 <?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns="http://www.opengis.net/sld" version="1.0.0">
 2   <sld:NamedLayer>
 3     <sld:Name>Class</sld:Name>
 4     <sld:UserStyle>
 5       <sld:Name>Class</sld:Name>
 6       <sld:FeatureTypeStyle>
 7         <sld:Rule>
 8           <sld:Name>Class</sld:Name>
 9           <sld:RasterSymbolizer>
10             <sld:ColorMap type="intervals">
11               <sld:ColorMapEntry color="#000A64" opacity="1.0" quantity="-1.0E25" label="zero"/>
12               <sld:ColorMapEntry color="#641400" opacity="1.0" quantity="3.0E12" label="one"/>
13               <sld:ColorMapEntry color="#C81E32" opacity="1.0" quantity="1.0E20" label="two"/>
14               <sld:ColorMapEntry color="#FFFFFF" opacity="0.0" quantity="5.0E25"/>
15             </sld:ColorMap>
16             <sld:VendorOption name="addAttributeTable">true</sld:VendorOption>
17           </sld:RasterSymbolizer>
18         </sld:Rule>
19       </sld:FeatureTypeStyle>
20     </sld:UserStyle>
21   </sld:NamedLayer>
22 </sld:StyledLayerDescriptor>

This is a map generated using the style, with the GetFeatureInfo containing the classification as an extra attribute:

../../_images/rat_map.png

REST API

A REST API is available, to fetch the full PAM dataset attached to a raster, and to create styles out of RAT classfication fields: