Friday 7 July 2017

openlayers 2 - GetLegendGraphic request string is too long?


I am setting the SLD Body of a WMS layer on the client side. I set the style in JSON and I have some functions that convert the JSON to SLD (OpenLayers functions). It works fine for displaying the layer with all its colors.


But when I use a legend (GetLegendGraphic from GeoServer), I have a limit in the size of the SLD Body. The limit of characters is about 20.000. When I perform the GetLegendGraphic request and the url is longer than (about) 20.000 characters, an error occurs and the legend is not displayed. BUT the layer is still correctly displayed (as you can see in the images below).


Below the 20.000 characters, the legend works fine.


I find it strange that the layer is correctly displayed and the legend isn't. Both are fetched via GeoServer requests.


Could you help me solve this?


I wanted a way to accept long strings in the GetLegendGraphic or a way to compress the string with the SLD body (so that it has fewer characters).


EXAMPLES:


SLD Body with 18006 characters (this shows a correct legend)


GOOD



SLD Body with 24245 characters (this does not show the legend, still draws the layer correctly)


BAD




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...