Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leaflet get the current style of a layer

Tags:

leaflet

In leaflet javascript library i can't get the style value of a layer. I have looked at the documentation but i can't see any way to do this!

Here how i set the style :

layer.setStyle({
    weight: 5,
    color: '#666',
    dashArray: '',
    fillOpacity: 0,
    opacity: 0.9,
});

There is a methode setStyle but not getStyle ... How can i check for those values? I need this to know the state of a layer to know what to do if the layer is "red" etc ...

Thank you!

like image 538
7vingt Avatar asked Aug 01 '13 10:08

7vingt


1 Answers

layer.options contains those values.

like image 140
Mics Avatar answered Nov 23 '22 19:11

Mics