Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend Request builds wrong URI for Legend #15

Open
oldwired opened this issue Jun 26, 2022 · 1 comment
Open

Legend Request builds wrong URI for Legend #15

oldwired opened this issue Jun 26, 2022 · 1 comment

Comments

@oldwired
Copy link

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&amp;VERSION=1.1.0&amp;FORMAT=image/png&amp;LAYER=dwd:Warnungen_Gemeinden&amp;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&amp;VERSION=1.1.0&amp;FORMAT=image/png&amp;LAYER=dwd:Warnungen_Gemeinden&amp;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

@mrzh4s
Copy link
Contributor

mrzh4s commented Mar 3, 2023

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&amp;VERSION=1.1.0&amp;FORMAT=image/png&amp;LAYER=dwd:Warnungen_Gemeinden&amp;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&amp;VERSION=1.1.0&amp;FORMAT=image/png&amp;LAYER=dwd:Warnungen_Gemeinden&amp;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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants