0.1.0 • Published 6 years ago

leaflet.zoomshowhide v0.1.0

Weekly downloads
8
License
LGPLv3
Repository
github
Last release
6 years ago

leaflet-zoom-show-hide

Npm package leaflet.zoomshowhide

Show/hide leaflet layers based on zoom level.

zsh = new ZoomShowHide();
zsh.addTo(map);
layer1.min_zoom = 7;
layer1.max_zoom = 14;
zsh.addLayer(layer1);
layer2.min_zoom = 9;
zsh.addLayer(layer2);

You can also remove and clear layers.

zsh.removeLayer(layer1);
zsh.clearLayers(layer1);

Demo

Also see Leaflet.markercluster which merges the markers into groups to reduce crowding instead of hiding them.

Tip:

If you get all your markers as a single geojson object from the server, geojson is just json, so it is easy to divide it up into separate layers in javascript.

0.1.0

6 years ago

0.0.0

6 years ago