Geographic Information Systems Asked on May 8, 2021
I use Leaflet to show a WMS Layer via a proxy.php (for authentication). That is working on most WMS Layers. But I have some WMS Sources, which are having a small shift in the tiles. See Overlay Map in the example.
<!DOCTYPE html>
TEST MAP
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
var map1 = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 30,
maxNativeZoom: 18
});
var map4 = new L.tileLayer.wms("proxy.php?url=http://geoshop.kommunalportal.ch/SWMS?", {
layers: 'lk_wms_wasser',
format: 'image/png',
transparent: true,
maxZoom:30
});
var map = L.map('mapid').setView([47.549904, 9.152927], 18);
var baseMaps = {
"map1": map1
};
var overlayMaps = {
"map4": map4
};
L.control.layers(baseMaps, overlayMaps).addTo(map);
map1.addTo(map);
map4.addTo(map);
Standard projection for Leaflet is EPSG:3857
. If you submit GetCapabilites
request to you WMS server, you'll see that it supports only the following projections: EPSG:2056
and EPSG:21781
.
This means two things:
proj4leaflet
plugin and then use it for your layer and your map.EPSG:3857
projection.Correct answer by TomazicM on May 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP