Skip to content

GSIP 146

Jody Garnett edited this page Jun 14, 2016 · 12 revisions

GSIP 146 - WMS GetLegendGraphic layout improvements

Overview

Introduce new options (LEGEND_OPTIONS) to allow alternative icons layout in bitmap GetLegendGraphic outputs, such as horizontal layout, multi column and multi row layouts.

Proposed By

Mauro Bartolomeoli

Assigned to Release

This proposal is for GeoServer 2.10 and later.

State

  • Under Discussion
  • In Progress
  • Completed
  • Rejected
  • Deferred

Motivation

The current standard single column vertical layout of icons can be sub-optimal when you have many rules. In many cases having more than one column allows to get more visible icons in a more compact space. Moreover, depending on the client application preference, often having icons layed out horizontally can be preferrable. With a couple of additional options we could allow for both this kind of layouts.

Proposal

I would like to add support for some new keys in WMS GetLegendGraphic LEGEND_OPTIONS property:

  • layout: with vertical (default) and horizontal as possible values
  • columnHeight/rowWidth: to allow multicolumn/row layouts based on a max size (in pixels) for the column / row
  • columns/rows: to allow multicolumn/row layouts based on a fixed (max) # of columns / rows

When specifying both columnHeight - columns (or rowWidth - rows) the columns / rows will be filled with icons up to the column (row) max size, but no more than the specified # of columns (rows) will be rendered (this could lead to some missing icons in the rendering).

Here are some samples:

Horizontal layout:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&LEGEND_OPTIONS=layout:horizontal

horizontal layout

Horizontal layout with rows:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&LEGEND_OPTIONS=layout:horizontal;rows:2

horizontal layout with rows

Horizontal layout with rowwidth:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&LEGEND_OPTIONS=layout:horizontal;rowwidth:135

horizontal layout with rowwidth

Vertical layout with columns:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&LEGEND_OPTIONS=columns:2

vertical layout with columns

Vertical layout with columnheight:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&LEGEND_OPTIONS=columnheight:50

vertical layout with columnheight

Raster ramp style with horizontal layout:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=100&HEIGHT=20&LAYER=nurc:Arc_Sample&LEGEND_OPTIONS=forceRule:True;dx:5.2;dy:1.2;mx:0.2;my:0.2;fontStyle:bold;borderColor:0000ff;border:true;fontColor:ff0000;fontSize:18;layout:horizontal

horizontal layout ramp

Raster intervals style with horizontal layout:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&&STYLE=test&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=nurc:Arc_Sample&LEGEND_OPTIONS=layout:horizontal

horizontal layout intervals

Raster intervals style with vertical layout and columnheight:

http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&&STYLE=test&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=nurc:Arc_Sample&LEGEND_OPTIONS=layout:vertical;columnheight:50

vertical layout intervals with columnheight

Backwards Compatibility

No backwards compatibility issue should arise, since when the new parameters are not specified the old standard layout will apply.

Discussion

Voting

Project Steering Committee:

  • Alessio Fabiani: +1
  • Andrea Aime: +1
  • Ben Caradoc-Davies: +1
  • Brad Hards: +1
  • Christian Mueller: +1
  • Ian Turton: +1
  • Jody Garnett: +1
  • Jukka Rahkonen: +1
  • Kevin Smith:
  • Simone Giannecchini: +1

Links

Clone this wiki locally