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

WMS with Leaflet #74

Open
ezizrehimov opened this issue Oct 21, 2021 · 4 comments
Open

WMS with Leaflet #74

ezizrehimov opened this issue Oct 21, 2021 · 4 comments

Comments

@ezizrehimov
Copy link

Hi. do you can help me? i have wms map url and layers. but i did not can use this with leaflet.
can you share with me any sample?

For charts output tests can use WMS endpoint:
http://gis.marine-vts.site/geoserver/wms?version=1.1.0

Here is the layers list for the place:
s57_7A100
s57_7A200
s57_7A300
s57_7A400
s57_7A402
s57_7A502
s57_7A602
s57_7A623

i tryed this :

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"/>
    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
    <style>
        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
        }
    </style>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
<div id="map"></div>
<script>
    var map = L.map('map').setView([55.67, 12.60], 11);

    var mywms = L.tileLayer.wms("http://gis.marine-vts.site/geoserver/wms?version=1.1.0", {
        layers: 's57_7A100',
        format: 'image/png',
        transparent: true,
        version: '1.1.0',
        attribution: "myattribution"
    });

    mywms.addTo(map);

</script>
</body>
</html>

Can you help me? how i use this wms map with leaflet

@apdevelop
Copy link

apdevelop commented Oct 22, 2021

Requesting the specified layer s57_7A100 gives Could not find layer s57_7A100 exception in WMS server response.
Using another layer identifier and map location I've got proper map image response (several blue filled circles):
var map = L.map('map').setView([40.283, 50.495], 12);
...
layers: 'vts:SAR_POINTS',

So, the wrong layer identifier is an issue. You can use any full-featured desktop GIS application (QGIS, for example) to get proper names of layers needed. Or just get them from WMS GetCapabilities request output using only browser.

@ezizrehimov
Copy link
Author

@apdevelop thank you.
i tryed with QGIS , but here opened so much layers name. how i get main layers?

@apdevelop
Copy link

how i get main layers?

Have a look at the service documentation or contact the service owner.. otherwise layers needs checking one-by-one. May be their names can give a clue.

@ezizrehimov
Copy link
Author

thank you for advices.

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