V
V
Vitaly Feklin2020-04-14 19:03:28
JavaScript
Vitaly Feklin, 2020-04-14 19:03:28

How to get the name/ID of the current map layer in Leaflet?

How to get the name/ID of the current layer in Leaflet?
Tried like this, but the IDs are dynamic:

map.on('baselayerchange', function(e){
alert(e.layer._leaflet_id);
});


The task is to somehow identify and save the layer in the cookie.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-04-14
@Sweby

How to, how to read documentation
https://leafletjs.com/reference-1.6.0.html#layersc...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question