When I add two layers to a Leaflet map (a basemap and a Geoserver WMS), the basemap disappers. But when its tiling, it can be seen for a moment.
What's the problem? Maybe it's due to the transparency or to the zIndex?
This is the basemap (OSM)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
zIndex: 2
}).addTo(map);
and this is the Geoserver WMS
var wmsLayer = L.tileLayer.wms('http://188.213.174.15:8080/geoserver/wms?', {
layers: 'varymaps:badacstur',
transparent: true,
zIndex: 1
}).addTo(map);
Best Answer
You are giving a zIndex to the basemap with a superior value than the WMS layer, my guess is that's what causing this problem, you should invert the z-indexes
basemap :
zIndex: 1;
WMS layer:
zIndex: 2;