When working with AGS map-sources, legend support is a little annoying, so it might be nice to be able to retrieve a WMS legend for an AGS service that also supports WMS GetLegend request.
When accessing a WMS, a legend image can be retrieved via the GetLegend OnlineResource URL specified in the WMS GetCapabilities of the relevant service.
an example legend from a federal WMS served from an AGS server:
https://hazards.fema.gov/nfhl/services/public/NFHLWMS/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=12
Seems like we could reference that legend like this:
<map-source name="fema-nfhl" type="ags"><url>https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer/export</url><param name="cross-origin" value="anonymous"/><layer name="SFHA" query-as="fema-nfhl-query/SFHA" ><param name="layers" value="show:28"/><param name="FORMAT" value="image/png;bits=8"/><legend type="html"><![CDATA[ <img width="220" src="http://hazards.fema.gov/nfhl/services/public/NFHLWMS/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=12"/> ]]></legend></layer></map-source>
Currently this does not seem to work, even though the specified URL does retrieve a valid Legend png file.
I see this may relate to https://github.com/geomoose/gm3/issues/556 , but perhaps the suggestion here is a specific direction we could go in for services that happen to have both pathways available
This is probably a minor "nice to have":
When working with AGS map-sources, legend support is a little annoying, so it might be nice to be able to retrieve a WMS legend for an AGS service that also supports WMS GetLegend request.
When accessing a WMS, a legend image can be retrieved via the GetLegend OnlineResource URL specified in the WMS GetCapabilities of the relevant service.
an example legend from a federal WMS served from an AGS server:
https://hazards.fema.gov/nfhl/services/public/NFHLWMS/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=12
Seems like we could reference that legend like this:
<map-source name="fema-nfhl" type="ags">
<url>https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer/export</url>
<param name="cross-origin" value="anonymous"/>
<layer name="SFHA" query-as="fema-nfhl-query/SFHA" >
<param name="layers" value="show:28"/>
<param name="FORMAT" value="image/png;bits=8"/>
<legend type="html"><![CDATA[ <img width="220" src="http://hazards.fema.gov/nfhl/services/public/NFHLWMS/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=12"/>
]]>
</legend>
</layer>
</map-source>
Currently this does not seem to work, even though the specified URL does retrieve a valid Legend png file.