History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GEOS-242
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Gabriel Roldán
Reporter: Chris Holmes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
GeoServer

Add GetLegendGraphic support

Created: 28/Oct/04 02:45 PM   Updated: 10/Mar/05 09:54 PM
Component/s: WMS
Affects Version/s: 1.3.0-beta
Fix Version/s: 1.3.0-beta

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
From the sld spec (1.0.0):

The image references make use of the GetLegendGraphic operation of the SLD-WMS interface, with a separate reference for each image. The parameterization of the operation needs to be "overloaded" in the same way that parameters for the GetMap with an SLD are overloaded in order to handle the different kinds of clients. I.e., there is an XML-based HTTP-POST method for executing GetMap (which is the way that SLD is really intended to be used but nobody implements it), and there are HTTP-GET methods using SLD= and SLD_BODY= parameters to reference/transport the SLD for use in either "literal" or "library" mode (depending on whether the LAYERS= parameter is present). The GET parameters of the GetLegendGraphic operation are defined as follows:
Parameter Required Description
VERSIONRequired Version as required by OGC interfaces.

REQUEST
Required
Value must be "GetLegendRequest".
LAYER
Required
Layer for which to produce legend graphic.
STYLE
Optional
Style of layer for which to produce legend graphic. If not present, the default style is selected. The style may be any valid style available for a layer, including non-SLD internally-defined styles.
FEATURETYPE
Optional
Feature type for which to produce the legend graphic. This is not needed if the layer has only a single feature type.
RULE
Optional
Rule of style to produce legend graphic for, if applicable. In the case that a style has multiple rules but no specific rule is selected, then the map server is obligated to produce a graphic that is representative of all of the rules of the style.
SCALE
Optional
In the case that a RULE is not specified for a style, this parameter may assist the server in selecting a more appropriate representative graphic by eliminating internal rules that are out-of-scope. This value is a standardized scale denominator, defined in Section 10.2
SLD
Optional
This parameter specifies a reference to an external SLD document. It works in the same way as the SLD= parameter of the WMS GetMap operation.
SLD_BODY
Optional
This parameter allows an SLD document to be included directly in an HTTP-GET request. It works in the same way as the SLD_BODY= parameter of the WMS GetMap operation.
FORMAT
Required
This gives the MIME type of the file format in which to return the legend graphic. Allowed values are the same as for the FORMAT= parameter of the WMS GetMap request.
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.
EXCEPTIONS
Optional
This gives the MIME type of the format in which to return exceptions. Allowed values are the same as for the EXCEPTIONS= parameter of the WMS GetMap request.

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.
Here is an example invocation:
http://www.vendor.com/wms.cgi?VERSION=1.1.0&REQUEST=GetLegendGraphic&LAYER=ROADL_1M%3Alocal_data&STYLE=my_style&RULE=highwaysSLD=http%3A%2F%2Fwww.sld.com%2Fstyles%2Fkpp01.xmlWIDTH=16&HEIGHT=16&FORMAT=image%2Fgif&
which would produce a 16x16 icon for the Rule named "highways" defined within layer "ROADL_1M:local_data" in the SLD. The list of available formats for legend graphics and exceptions can be assumed to be the same as are available for a map in the WMS GetMap request.
An alternative approach to using a GetLegendGraphic operation would be for the viewer client to render a style sample directly itself using the style description. This would save some interactions between the client and server and would allow the viewer client to present consistent sample shapes (across remote map servers from different vendors), although the legend graphics might look different from the graphics actually rendered in the map since the viewer and server may have different rendering engines and different graphical capabilities.
The LegendGraphic element of an SLD Rule (defined in Section 10.1) actually only has a limited role in building legends. For vector types, a map server would normally render a standard vector geometry (such as a box) with the given symbolization for a rule. But for some layers, such as for Digital Elevation Model (DEM) data, there is not really a "standard" geometry that can rendered in order to get a good representative image. So, this is what the LegendGraphic SLD element is intended for, to provide a substitute representative image for a Rule. For example, it might reference a remote URL for a DEM layer called "GTOPO30":
http://www.vendor.com/sld/icons/COLORMAP_GTOPO30.png



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Gabriel Roldán - 10/Mar/05 02:25 PM
it's done. Just forgot to update the issue.

Chris Holmes - 10/Mar/05 09:54 PM
Looks good to me, has working examples in user basic config, closing.