1

I want to know if is possible to change spacing of a normal (not raster) legend in Geoserver:

enter image description here

I need to add more space between the squares and the text.

There are dx,dy,mx,my parameters but they only work for Raster Layers

3

Mauro Bartolomeoli is proposing new vendor options to control margin around labels just this week: http://osgeo-org.1560.x6.nabble.com/WMS-GetLegendGraphic-td5293025.html

So, I would expect to find this functionality in a release in the next few months (if I had to guess, maybe 2.9.4 in January 2017, maybe 2.10.1 in December 2016)

2

The Geoserver manual is a good spot to check out more information.

You could use the GetLegendGraphic to change the normal legend graphics.

The GetLegendGraphic operation itself is optional for an SLD-enabled WMS. It provides a general mechanism for acquiring legend symbols, beyond the LegendURL reference of WMS Capabilities. Servers supporting the GetLegendGraphic call might code LegendURL references as GetLegendGraphic for interface consistency. Vendor-specific parameters may be added to GetLegendGraphic requests and all of the usual OGC-interface options and rules apply. No XML-POST method for GetLegendGraphic is presently defined.

These two parameters can be specified for Vector graphics, as in your case.

WIDTH Optional This gives a hint for the width of the returned graphic in pixels. Vector-graphics can use this value as a hint for the level of detail to include.

HEIGHT Optional This gives a hint for the height of the returned graphic in pixels.

Furthermore,

GeoServer allows finer control over the legend appearance via the vendor parameter LEGEND_OPTIONS. The general format of LEGEND_OPTIONS is the same as FORMAT_OPTIONS,

You could get more details from the Geoserver manual

  • Thanks, I found that article before asking, but there isn't any documented way to do what I'm trying to do – IAmJulianAcosta Oct 27 '16 at 21:22
  • You just need to play around with the getlegendgraphic request, @IAmJulianAcosta. Perhaps add the request you're using now in your question? – Alex Leith Oct 28 '16 at 0:14

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.