Currently GetLegendGraphic requests in OLIVER do not include a width parameter.
However, when making requests to external WMS servers which are backed by
ArcGIS Server the legend is often cut off. For example:
http://csc.noaa.gov/ArcGISPUB/services/MultipurposeMarineCadastre/MultipurposeMa
rineCadastre/MapServer/WMSServer?TRANSPARENT=TRUE&FOO=Shipping%20Fairways%2C%20L
anes%2C%20and%20Zones&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTI
ONS=application%2Fvnd.ogc.se_xml&LAYER=83&SCALE=2183916.2728723255&FORMAT=image%
2Fgif
results in the attached image external_ags_wms_legend_no_width_specified.gif
Since the GetCapabilities .xml of each external WMS is stored locally on the
maps server we can edit the file and specify an appropriate width for each
legend. For example in
http://maps.massgis.state.ma.us/map_ol/noaa_mmc_public_wms_getcaps_20121212.xml
we have specified
LegendURL width="350"
for the layer Shipping Fairways, Lanes, and Zones.
We suggest that OLIVER detect this and use the value to append &width=value to
the GetLegendGraphic URL. But only for ArcGIS Server backed WMS.
See the fixed example
http://csc.noaa.gov/ArcGISPUB/services/MultipurposeMarineCadastre/MultipurposeMa
rineCadastre/MapServer/WMSServer?TRANSPARENT=TRUE&FOO=Shipping%20Fairways%2C%20L
anes%2C%20and%20Zones&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTI
ONS=application%2Fvnd.ogc.se_xml&LAYER=83&SCALE=2183916.2728723255&FORMAT=image%
2Fgif&width=350
and the result attached as external_ags_wms_legend_width_specified.gif
The reason why it's important to only add width to ArcGIS Server-backed WMS is
that adding width to a GeoServer backed WMS will stretch the swatches
unacceptably. Compare the following 2 URLs.
no width with GeoServer:
http://giswebservices.massgis.state.ma.us/geoserver/wms?TRANSPARENT=TRUE&STYLE=G
ISDATA.LANDUSE_POLY%3A%3A21_Classes_1971_Solid&FOO=Land%20Use%201971%2021%20Clas
ses&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2F
vnd.ogc.se_xml&LAYER=massgis%3AGISDATA.LANDUSE_POLY&SCALE=17061.845881815043&FOR
MAT=image%2Fgif
attached as geoserver_wms_legend_no_width_specified.gif
width with GeoServer:
http://giswebservices.massgis.state.ma.us/geoserver/wms?TRANSPARENT=TRUE&STYLE=G
ISDATA.LANDUSE_POLY%3A%3A21_Classes_1971_Solid&FOO=Land%20Use%201971%2021%20Clas
ses&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2F
vnd.ogc.se_xml&LAYER=massgis%3AGISDATA.LANDUSE_POLY&SCALE=17061.845881815043&FOR
MAT=image%2Fgif&width=100
attached as geoserver_wms_legend_width_specified.gif
In order to determine if the WMS is ArcGIS Server-backed I suggest we add the
keyword "ArcGIS Server" to our local GetCapabilities XML file for that external
WMS service. See
http://maps.massgis.state.ma.us/map_ol/noaa_mmc_public_wms_getcaps_20121212.xml
Original issue reported on code.google.com by Aleda.Fr...@state.ma.us on 17 Dec 2012 at 3:41
Original issue reported on code.google.com by
Aleda.Fr...@state.ma.us
on 17 Dec 2012 at 3:41Attachments: