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:
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:
Answer
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.
No comments:
Post a Comment