using.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .. _rat_using:
  2. Using the RAT Module
  3. ====================
  4. The RAT modules adds facilities to explore a Raster Attribute Table, and generate styles
  5. based on a classification column of choice.
  6. If the source raster contains a RAT, a new panel will appear in the :guilabel:`Publishing` tab of the layer.
  7. .. image:: images/rat_panel.png
  8. The table allows for exploration of the attribute table, while the toolbar at the top
  9. allows to generate styles based on the table contents:
  10. * The :guilabel:`Band` dropdown allows to select a raster band.
  11. * The :guilabel:`Classification` dropdown allows to select a column to use for classification.
  12. * The :guilabel:`Style name` controls the name of the style to be generated. It's automatically filled
  13. with a naming convention of ``<layer>_b<band>_<classification>``, but can be customized.
  14. * The :guilabel:`Create style` button generates the style based on the chosen classification, eventually using colors if available in the table, otherwise generating random colors. The generated style will also be included among the "alternate styles" of the layer.
  15. 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.
  16. Here is an example style:
  17. .. code-block:: xml
  18. :linenos:
  19. <?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">
  20. <sld:NamedLayer>
  21. <sld:Name>Class</sld:Name>
  22. <sld:UserStyle>
  23. <sld:Name>Class</sld:Name>
  24. <sld:FeatureTypeStyle>
  25. <sld:Rule>
  26. <sld:Name>Class</sld:Name>
  27. <sld:RasterSymbolizer>
  28. <sld:ColorMap type="intervals">
  29. <sld:ColorMapEntry color="#000A64" opacity="1.0" quantity="-1.0E25" label="zero"/>
  30. <sld:ColorMapEntry color="#641400" opacity="1.0" quantity="3.0E12" label="one"/>
  31. <sld:ColorMapEntry color="#C81E32" opacity="1.0" quantity="1.0E20" label="two"/>
  32. <sld:ColorMapEntry color="#FFFFFF" opacity="0.0" quantity="5.0E25"/>
  33. </sld:ColorMap>
  34. <sld:VendorOption name="addAttributeTable">true</sld:VendorOption>
  35. </sld:RasterSymbolizer>
  36. </sld:Rule>
  37. </sld:FeatureTypeStyle>
  38. </sld:UserStyle>
  39. </sld:NamedLayer>
  40. </sld:StyledLayerDescriptor>
  41. This is a map generated using the style, with the GetFeatureInfo containing the classification
  42. as an extra attribute:
  43. .. image:: images/rat_map.png
  44. REST API
  45. --------
  46. A REST API is available, to fetch the full PAM dataset attached to a raster, and to create
  47. styles out of RAT classification fields:
  48. * :api:`/rat <rat.yaml>`