How is the Layer Order is decided in leaflet map? -
when use following code go through layers in leaflet map,
map.eachlayer(function (layer) { console.log(layer); });
i wants rule used create order. because of zindex of layer? or because layer added in different time? if layer added early, in bottom.
thanks,
good question, seems leafletjs docs don't ordering of layers via eachlayer
, so...
looking @ code on github, l.map.eachlayer loops through l.map._layers object (not array). technically layers come in order...
that said, individual layers added _layers
object in order added map. in likelihood, eachlayer
iterating on layers in same order (whatever order added map).
Comments
Post a Comment