Add / Remove layer event

24 views
Skip to first unread message

Troy Coburn

unread,
Feb 11, 2018, 3:46:06 PM2/11/18
to OpenLayers Dev
I've been looking all over and can't seem to find anything.

Is there an event that is fired when a layer is added or removed from the map?

Cheers!

Troy

Bart van den Eijnden

unread,
Feb 12, 2018, 3:59:04 AM2/12/18
to openlay...@googlegroups.com

getLayers will return the collection of layers of the map, and you can listen for add and remove there:

https://openlayers.org/en/latest/apidoc/ol.Collection.html

--
You received this message because you are subscribed to the Google Groups "OpenLayers Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlayers-de...@googlegroups.com.
To post to this group, send email to openlay...@googlegroups.com.
Visit this group at https://groups.google.com/group/openlayers-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlayers-dev/6d010044-03b9-4afe-96cf-17e801a117f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Bart van den Eijnden
JavaScript developer | Boundless
bar...@boundlessgeo.com

Troy Coburn

unread,
Feb 12, 2018, 6:07:45 AM2/12/18
to OpenLayers Dev
Yup, that's exactly what I was looking for! Thought I had given that a go over last night too but it seems to work.

Thanks
Reply all
Reply to author
Forward
0 new messages