Created
April 22, 2015 02:34
-
-
Save hanislovingit/fd8003c399ae7b74c7a4 to your computer and use it in GitHub Desktop.
Mapbox-creation-api-layerGroup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a LayerGroup object for collecting markers | |
var markersLayerGroup = L.layerGroup(); | |
// add some markers to the collection | |
markersLayerGroup.addLayer(marker1); | |
markersLayerGroup.addLayer(marker2); | |
// add the collection of markers LayerGroup to the map. | |
markersLayerGroup.addTo(map); | |
// or | |
map.addLayer(markersLayerGroup); | |
// Note that when we are creating a LayerGroup object, we don't have the option to set its | |
// visibility on the map, like it does in EntityCollection creation API in Bing map. We make the | |
// LayerGroup object visible when we add it to the map, and make it invisible when we remove | |
// it from the map. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment