z index - geoJSON layer order leaflet -
i have problem geojson layer order in leaflet. have 3 polygon layers in leaflet, geojson, overlay. i'm not able figure out, how set layer order. i've tried autozindex: true/false - didn't work. after toggling layer visibility reordered , i'm unhappy :(
below part of code. i'm begginer, glad help. thanks, dan
var povoden_5q = l.geojson(povoden_5q_diba, {style: style, oneachfeature: oneachfeature}); var povoden_20q = l.geojson(povoden_20q_diba, {style: style, oneachfeature: oneachfeature}); var povoden_100q = l.geojson(povoden_100q_diba, {style: style, oneachfeature: oneachfeature}); map = new l.map('mapa', { layers: [topo, povoden_5q] }); var podklad = { "letecký snímek": ortofoto, "topografická mapa": topo } var overlay = { "záplavové území pětileté vody": povoden_5q, "záplavové území dvacetileté vody": povoden_20q, "záplavové území stoleté vody": povoden_100q } map.setview(new l.latlng(50.9296561, 15.1377869),15); l.control.layers(podklad, overlay,{collapsed:false, autozindex:true}).addto(map);
what layer.bringtofront()
, layer.bringtoback()
methods?
in case, like:
... l.control.layers(podklad, overlay,{collapsed:false, autozindex:true}).addto(map); povoden_5q.bringtoback(); povoden_100q.bringtofront();
or that.
see docs here.
Comments
Post a Comment