Is there a method or property in javascript using the Openlayers (3 or) 4 library which I can use to verify if a given layer is a layer group?
2 Answers
You can test your layer to see if it's an instance of a layer group:
if (myLayer instanceof ol.layer.Group) {
alert("It's a group!");
}
-
spot on. i had found this a short while ago. UPVOTED and CHOSEN. : ) PS next question: how to get child layers in group?– tony gilJul 21, 2017 at 20:59
-
Check out this leaflet plugin:
https://www.npmjs.com/package/leaflet.markercluster.layersupport
checkIn() methods may return added layer groups.