I have a leaflet map with 2 layers
First layer
layers: {
baselayers: {
osm: {
name: 'OpenStreetMap',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type: 'xyz',
visible : false,
layerParams: {
showOnSelector: true
}
},
vplan: {
name: 'vplan',
type: 'imageOverlay',
url: 'img/map.png',
visible : false,
bounds: [[config.bottomLeftLat, config.bottomLeftLong], [config.topRightLat, config.topRightLong]],
layerParams: {
showOnSelector: true,
noWrap: false,
opacity : 0.6
}
},
}
}
As you can see OSM is openstreetmap and the other on is PNG image. Both layers are available in the layer selector - OK
Every second I make an Http request to retrieve geoJson data.
$scope.geojson = $http.get(...);
When landing on the page with the map, the geoJson is shown over the open street map - OK
My problem is that when switching to the other layer (PNG image) the geoJson is no more over the layer but behind. After setting the opacity to 0.6, I can see the geoJson behind.
How can I always put the geoJson on top of every layer ?