Open soli004 opened 6 years ago
I'm having this problem too, although I haven't ruled out that maybe I'm not doing something right, but I don't have that issue with other layers (that aren't vectorgrids), so it does seem like this is a vectorgrid problem...
Have you tried explicitly adding the different layers to different map panes?
No I haven't, I just add it to the map like every other layer. Is there a pane you would suggest?
On Tue, Apr 17, 2018 at 2:08 PM, Tom Chadwin notifications@github.com wrote:
Have you tried explicitly adding the different layers to different map panes?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Leaflet/Leaflet.VectorGrid/issues/154#issuecomment-382088661, or mute the thread https://github.com/notifications/unsubscribe-auth/AYgWKQpsQMg9xIb1-X96PilhU6pf45l5ks5tpi-VgaJpZM4SvaBS .
-- -- Chris Marx ZevRoss - Know Your Data Data Science & Spatial Analysis New website: www.zevross.com Ithaca, NY
No, I don't mean you should do it in production without a reason to. I just thought it would be useful to see if placing each in their own pane is a workaround, and might help debugging this issue.
Kind of happy that others seem this problem as well, felt a bit alone here. When using vectorgrid I use only one basemap as that work for the moment waiting for an solution, if I apply the second basemap the problems get back... I have no idea what causes this, it happens on Chrome and Safari
Yeah same here, with one basemap I was fine, adding in a second (satellite in my case), I got the problem-
On Tue, Apr 17, 2018 at 3:20 PM, soli004 notifications@github.com wrote:
Kind of happy that others seem this problem as well, felt a bit alone here. When using vectorgrid I use only one basemap as that work for the moment waiting for an solution, if I apply the second basemap the problems get back... I have no idea what causes this, it happens on Chrome and Safari
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Leaflet/Leaflet.VectorGrid/issues/154#issuecomment-382110907, or mute the thread https://github.com/notifications/unsubscribe-auth/AYgWKSfwvA9_kG65PDNXCsFjPA_oiDp2ks5tpkCZgaJpZM4SvaBS .
-- -- Chris Marx ZevRoss - Know Your Data Data Science & Spatial Analysis New website: www.zevross.com Ithaca, NY
I've encountered this previously and I'm pretty sure it's to do with how Leaflet decides on the layer order. For me, explicitly setting the zIndex of the layers so that the base layers load behind my VectorGrid layers seemed to correct the problem. Example -
var osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png',
{
zIndex: 1,
attribution: '© OpenStreetMap contributors'}
);
var osm_bw = L.tileLayer('http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',
{
zIndex: 1,
attribution: '© OpenStreetMap contributors'}
);
var osm_bw2 = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
{
zIndex: 1,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="http://cartodb.com/attributions">CartoDB</a>'}
);
Your VectorGrid layers, wherever they're defined would have a zIndex value that's higher than your baselayers to ensure they render on top, or higher than other VectorGrid layers to bring them right to the front. Example from mine -
var defenceTileOptions = {
rendererFactory: L.canvas.tile,
zIndex: 3,
vectorTileLayerStyles: {
'defence': {
weight: 3,
color: 'DARKBLUE',
opacity: 1
}
}
};
Adding zIndex doesn't work for me. Here's one simple solution, though: bring your vector tile to front whenever there's a base layer change:
map.on('baselayerchange', function() {
if (map.hasLayer(vectorGrid)) {
vectorGrid.bringToFront();
}
});
Hello, I have problems with my polygon layers not showing up when changing base layers. I can se the polygon layers flashing up when I change base layer, it seem like it falls behind the base layer and not on top as it should. There is no problem with my circleMarkers they are always "on top" the only difference is that I am not using vectorGrid for the markers. If I remove all base layers I can see the polygons but then of course with no base map (seems base maps is hiding the polygon layers)... What causes this and how to solve it? I use the Layer Control Tree to activate layers ( I have also tried without using the Layer.Control.Tree plugin), here is part of the code... thanks