I have created the layout directory C:\Program Files (x86)\GeoServer 2.15.1\data_dir\layouts

In the directory I have created an xml file with the following:

    <decoration type="image" affinity="bottom,right" offset="6,6" size="80,31">
        <option name="C:\Program Files (x86)\GeoServer 2.15.1\data_dir\layouts" value="Uis_Extensions.png"/>

    <decoration type="scaleline" affinity="bottom,left" offset="36,6"/>

    <decoration type="legend" affinity="top,left" offset="6,6" size="auto"/>

The expectation is that when you go to layer preview the decoration should show overlayed on the WMS. I am getting none of that. What am I doing wrong?

  • can you please add the URL you are requesting? – Ian Turton Nov 13 at 9:59
  • The url part I do not understand very well. Where I have put the local file path, it said url before. That is where the xml is located, I have also put the png in the same directory, and Uis Extensions is the name of the png legend. According to this link wiki.state.ma.us/display/massgis/GeoServer+-+WMS+-+Decorations after doing that configuration, I should be able to get the url that I can use for the legend request. I believe I should also link the layout xml to the layer I would like to add the legend decoration. Unfortunately, I cannot figure out the logic. – Amelia Nicodemus Nov 13 at 10:24
  • Are WMS decorations static or can be used to get the legend that can be switched on and off? I am still trying to find a solution to my previous question by creating a custom legend and request that (gis.stackexchange.com/questions/341523/…). Let me study your answer. – Amelia Nicodemus Nov 13 at 10:34

To get GeoServer to use a layout to decorate a WMS image you must add the parameter &format_options=layout:foo as described in the manual (this assumes you have called your layout foo if not change foo to be the name of your layout file (without the xml)).

This will make no difference to the maps viewed in the layer preview as that doesn't add this parameter to the WMS requests that it makes.

  • I did some shortcuts there because the decorations are static. Basically, I created an SLD in qgis with just one polygon layer. I then republished the layer and used that SLD, I took the GetLegendGraphic url and use that in Leaflet. And this I can toggle on and off. – Amelia Nicodemus Nov 13 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.