Decorating a MapΒΆ

WMS Decorations provide a framework for visually annotating images from WMS with absolute, rather than spatial, positioning. This example of decoration include scaleline, legends, and image.

  1. Go to $geoserver_data and create a new directory named layouts and create a new file named boulder_ly.xml inside it.

  2. Inside the boulder_ly.xml file enter the following XML (replace ${geoserver_data} with your actual path, e.g., file://C:/training/geoserver_data ):

            <decoration type="image" affinity="top,left" offset="45,8"
                <option name="url"
                            value="${geoserver_data}/geosolutions-logo-tx.png" />
            <decoration type="text" affinity="bottom,right" offset="3,3">
                    <option name="message" value="Boulder City" />
                    <option name="font-size" value="14" />
                    <option name="font-color" value="#FFFFFF" />
                    <option name="halo-radius" value="1" />
                    <option name="halo-color" value="#000000" />
            <decoration type="scaleline" affinity="bottom,left" offset="3,3" />
            <decoration type="legend" affinity="top,right"
                                    offset="6,6" size="auto" />
  3. Save and close the file.

  4. Go to the Layer Preview to preview the new map decoration on geosolutions:Mainrd layer. Once the layout boulder_ly.xml is defined, request it by adding format_options=layout:boulder_ly to the request parameters.


    Map decoration

    The request:



Zoom-in until the layer and legend appears since for this layer we have scale_denominator based rules. Also you can apply this format_layout to any layer, but be careful with the overalys since you will have all the legends printed out on the right-top side of the map.