leaflet.zoomshowhide

0.1.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i leaflet.zoomshowhide

Weekly Downloads

28

Version

0.1.0

License

LGPLv3

Unpacked Size

12.2 kB

Total Files

6

Last publish

Collaborators

  • timthelion