Skip to content

Add note about GetLegendGraphic and SLD_VERSION #1068

Merged
geographika merged 1 commit intoMapServer:mainfrom
geographika:wms-sld
Mar 17, 2026
Merged

Add note about GetLegendGraphic and SLD_VERSION #1068
geographika merged 1 commit intoMapServer:mainfrom
geographika:wms-sld

Conversation

@geographika
Copy link
Member

Update the docs to match the implementation in mapwms.cpp.

if (nVersion >= OWS_1_3_0 && sld_version == NULL) {
  msSetErrorWithStatus(MS_WMSERR, MS_HTTP_400_BAD_REQUEST,
                       "Missing required parameter SLD_VERSION",
                       "GetLegendGraphic()");
  return msWMSException(map, nVersion, "MissingParameterValue",
                        wms_exception_format);
}
if (nVersion >= OWS_1_3_0 && strcasecmp(sld_version, "1.1.0") != 0) {
  msSetErrorWithStatus(MS_WMSERR, MS_HTTP_400_BAD_REQUEST,
                       "SLD_VERSION must be 1.1.0", "GetLegendGraphic()");
  return msWMSException(map, nVersion, "InvalidParameterValue",
                        wms_exception_format);
}

@geographika geographika added backport branch-8-0 To backport a pull request to branch-8-0 backport branch-8-2 To backport a pull request to branch-8-2 backport branch-8-4 To backport a pull request to branch-8-4 backport branch-8-6 (live) To backport a pull request to branch-8-6 labels Mar 16, 2026
@geographika geographika removed backport branch-8-0 To backport a pull request to branch-8-0 backport branch-8-2 To backport a pull request to branch-8-2 backport branch-8-4 To backport a pull request to branch-8-4 labels Mar 17, 2026
@geographika
Copy link
Member Author

Although it does seem strange to have to add that parameter, when it can only ever be one value. GetLegendGraphic doesn't seem to be part of the WMS spec so I'm not sure why it couldn't be added in the code automatically if missing.

@ejn
Copy link
Contributor

ejn commented Mar 17, 2026

Although it does seem strange to have to add that parameter, when it can only ever be one value. GetLegendGraphic doesn't seem to be part of the WMS spec so I'm not sure why it couldn't be added in the code automatically if missing.

GetLegendGraphic is an optional part of the "Styled Layer Descriptor profile of the Web Map Service Implementation Specification" (OGC 05-078r4 seems to be the newest version)

@geographika
Copy link
Member Author

Thanks @ejn. Table 8 — Parameters in GetLegendGraphic operation request in the spec lists it as mandatory:

image

@jratike80
Copy link

It seems that sld_version was introduced in OGC 05-078r4 together with a new SLD version 1.1.0.
The WMS 1.3.0 GetCapabilities contain schema location http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd that makes the use of sld_version mandatory.

WMS 1.1.x GetCapabilities contain just <UserDefinedSymbolization SupportSLD="1".
It probably means that with WMS 1.1.x only SDL version 1.0.0 (OGC 02-070) is supported.

@geographika geographika merged commit 95b2e8b into MapServer:main Mar 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport branch-8-6 (live) To backport a pull request to branch-8-6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants