leaflet-geoserver-request
leaflet-geoserver-request copied to clipboard
Legend Request builds wrong URI for Legend
I'm trying to use the Geoserver with WMS 1.3.0 of the german weather service "DWD". Getting the layer itself with
var wmsLayer = L.Geoserver.wms('https://maps.dwd.de/geoserver/ows?', {
layers: 'dwd:Warnungen_Gemeinden',
version: '1.3.0',
opacity: 0.5,
attribution: 'DWD'
}).addTo(map);
works.
But when I try to get the legend with
var layerLegend = L.Geoserver.legend('https://maps.dwd.de/geoserver/ows?', {
layers: 'dwd:Warnungen_Gemeinden',
style: `stylefile`,
});
layerLegend.addTo(map);
I only get the "broken graphic" symbol. When I inspect the source of the page I see that the wrong URI gets built:
<img src="https://maps.dwd.de/geoserver/ows?/wms?REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=dwd:Warnungen_Gemeinden&style=stylefile" alt="legend" data-toggle="tooltip" title="Map legend">
The right URI according to the "getCapabilities" document is
<LegendURL width="306" height="160">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://maps.dwd.de/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=dwd%3AWarnungen_Gemeinden"/>
</LegendURL>
Or short:
Worngly built: https://maps.dwd.de/geoserver/ows?/wms?REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=dwd:Warnungen_Gemeinden&style=stylefile
Correct according to GeoServer; https://maps.dwd.de/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=dwd%3AWarnungen_Gemeinden
I'm trying to use the Geoserver with WMS 1.3.0 of the german weather service "DWD". Getting the layer itself with
var wmsLayer = L.Geoserver.wms('https://maps.dwd.de/geoserver/ows?', { layers: 'dwd:Warnungen_Gemeinden', version: '1.3.0', opacity: 0.5, attribution: 'DWD' }).addTo(map);
works.
But when I try to get the legend with
var layerLegend = L.Geoserver.legend('https://maps.dwd.de/geoserver/ows?', { layers: 'dwd:Warnungen_Gemeinden', style: `stylefile`, }); layerLegend.addTo(map);
I only get the "broken graphic" symbol. When I inspect the source of the page I see that the wrong URI gets built:
<img src="https://maps.dwd.de/geoserver/ows?/wms?REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=dwd:Warnungen_Gemeinden&style=stylefile" alt="legend" data-toggle="tooltip" title="Map legend">
The right URI according to the "getCapabilities" document is
<LegendURL width="306" height="160"> <Format>image/png</Format> <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://maps.dwd.de/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=dwd%3AWarnungen_Gemeinden"/> </LegendURL>
Or short: Worngly built:
https://maps.dwd.de/geoserver/ows?/wms?REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=dwd:Warnungen_Gemeinden&style=stylefile
Correct according to GeoServer;https://maps.dwd.de/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=dwd%3AWarnungen_Gemeinden
hi.. i can say that you're using wrong request in your js.
var layerLegend = L.Geoserver.legend('https://maps.dwd.de/geoserver/ows?', {
layers: 'dwd:Warnungen_Gemeinden',
style: `stylefile`,
});
layerLegend.addTo(map);
it should be like this based on documentation given.
var layerLegend = L.Geoserver.legend('https://maps.dwd.de/geoserver/wms', {
layers: 'dwd:Warnungen_Gemeinden',
style: `stylefile`,
});
layerLegend.addTo(map);
or please don't put '?' at the end of your url.
thanks.