Open rollinstar opened 6 years ago
Could you try to use Leaflets layer control?
var layers = {
"buildings": osmb
};
L.control.layers(layers).addTo(map);
It should also allow to remove layers. See: http://leafletjs.com/examples/layers-control/
Thank you for your advice! But this way still cannot solve problem that z-index of each layer is changed when layers are toggled. My client want that particular layer is shown upper than OSMBuildings objects. However, I think that this problem should be solved by leaflet, so I will try to find a way using leaflet library myself. Thank you!
Hi, Thank you for providing a wonderful project like this! I'm developing a map using OSMBuildings, leaflet, and geojson. But, I faced a problem. My client want that OSMBuildings be toggled (on and off buildings) when they would like to see base maps. Firstly, I used a function(onRemove()) for clearing a OSMBuilding objects and removed OSMBuildings objects. Then, when I called a function(set()) for loading objects again, it did not operate. So, I declared a new OSMBuildings object again, and I could render the OSMBuildings objects. However, z-index of the OSMBuilding's instance changed to last z-index of leaflet map. How can I toggle the OSMBuilding's objects which is already rendered without changing z-index? Can you help me to solve this problem?