Skip to content

How to remove layer from group dynamically? #65

Description

@scarybook

I have noticed that both methods below only works when layer is added to a map directly and not to a group

panelLayers.removeLayer(toRemove)
or
toRemove.removeFrom(maps[mapId])

function addLayer(mapId, layer, layerId) {
    layer.id = layerId;
    layers[mapId].push(layer);
    layer.addTo(maps[mapId]);
}

function addLayerToGroup(groupId, layer, layerId) {
    layer.id = layerId;
    for (var i = 0; i < panelLayers._layers.length; i++) {
        if (panelLayers._layers[i].id == groupId) {
            layers[mapId].push(layer);
            panelLayers._layers[i].layer.addLayer(layer);
        }
    }
}

How to properly remove layer from the map when layer is in a group?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions