-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
A Leaflet user on IRC wanted to return a LayerGroup for a feature in their custom pointToLayer function but was getting an error. After some investigation, it looks like FeatureGroup (and GeoJSON by extension) expects all of its child layers to have L.Mixin.Events applied (i.e. to have an on method).
Thus, it is not possible to return a LayerGroup from pointToLayer - instead one must return a FeatureGroup which has the events mixin. This is probably better anyway, since presumably the user would want the same events applied to all members of the group. Should we:
- update the docs and the GeoJSON example to clarify that
pointToLayeronly works with eventedILayers (basically everything exceptLayerGroup) - and/or, update
FeatureGroup.addLayerto check to ensure the child layer is evented before trying to callon()