在传单中设置图层的缩放级别
问题描述
从这里继续查询:
我找到了一个解决方案,我们可以用更短和更长(虽然更实用)的方式来解释:
根据下面的例子:
https://gis.stackexchange.com/questions/258515/show-hide-markers-depending-on-zoom-level
我们可以这样做:
这对我们来说更好,不像较短的......
当缩放级别达到函数中给定的最大值时,可以将所有图层切换回来.
Continuing the query from here:
https://gis.stackexchange.com/questions/340223/leaflet-making-features-gone-when-zoom-out
I would like to have some layers completely gone when zooming out.
I tried sth like this:
} }
but unfortunately it isn't a thing, which I am looking for, because once one layer disappear, another one is coming in. Eventually, the very top layer remain still visible when zooming out to level 1 as per the example here:
http://jsfiddle.net/expedio/kuovyw8m/
Because I would like to have layers gone as zoom out I tried sth like this:
it doesn't work completely. COnsole says:
Uncaught SyntaxError: Unexpected token '{' which is a contradiction to the example here:
https://gis.stackexchange.com/questions/258515/show-hide-markers-depending-on-zoom-level
in other case I have:
Uncaught TypeError: sitec.removeFrom is not a function at i. ((index):174) at i.fire (leaflet.js:5) at i._moveEnd (leaflet.js:5) at i. (leaflet.js:5)
when type code like this:
as per the example here:
https://gis.stackexchange.com/questions/182657/zoom-dependent-layers-in-leaflet
Last thing which I tried was the plugin available here:
https://github.com/auto-mat/leaflet-zoom-show-hide/blob/master/demo.html
Where I put:
but still wothiut result. The console says:
uncaught TypeError: layer.addTo is not a function -> from leaflet-zoom-hide 21 layer.addTo(this._layerGroup);
Does anyone know how to deal with it?
My code is available here:
I found one of the solution, that we can explain by shorter and longer (although more practical) way:
According to the example below:
https://gis.stackexchange.com/questions/258515/show-hide-markers-depending-on-zoom-level
We can do sth like this:
which is better for us, unlike to shorter one...
that can switch all layers back when zoom level reach max value given in the function.
这篇关于在传单中设置图层的缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!