0

When creating an SLD for a single polygon layer in QGIS and using that in Geoserver, by default the legend description is "single symbol". When you categorize the single polygon layer symbology and classify that based on a single attribute, you then can change the symbol name to whatever name or description you would like. This solves the single symbol description issue for your GetLegendGraphic displaying in either OpenLayers/Leaflet. This works for a single polygon. Multiple polygons layer categorized based on unique values and different styling also work fine. The challenge I have is creating an SLD for a multi polygon layer that shares the same styling with unique labels so that on the legendgraphic/png, there is a single symbology and description next to it. Is there a solution that I can possibly do in QGIS without having a polygon SLD and creating a point layer for the labels?

This is the single polygon layer in Leaflet: enter image description here

This is what I would like to have in leaflet, basically the same as the single polygon but with different labels, tried categorizing but did not work: enter image description here

  • can you add some pictures to explain what you are seeing and what you would like to see – Ian Turton Nov 12 at 12:37
  • It seems this will not work and the solution will be to create the custom legend. I have created the png legend file. I am not sure where to place this in Geoserver in order to meet the requirements for the WMS GetLegendGraphic parameters. – Amelia Nicodemus Nov 13 at 6:42
0

How I solved this was I created an SLD in QGIS with one polygon layer. I classified it and gave it an appropriate legend description. In GeoServer, I republished the same layer but this time for the purpose of getting the legend only (gave it another name), and use that SLD. I then get that particular legend URL and call that in leaflet.

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.