Saturday 21 March 2015

qgis - Legend Graphic for a multi polygon layer styled the same with unique (different) labels


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



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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...