This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

how to hide my leaflet markers in all layers except 17 and 18 (visible only there)?

0

I downloaded the Leaflet 0.7.3 of http://leafletjs.com/download.html
I put my own markers like here - http://leafletjs.com/examples/custom-icons.html
I want the markers were visible only in the larger 17 and 18

What do I add a file leaflet.js?

asked 05 May '15, 22:05

Meku13's gravatar image

Meku13
11112
accept rate: 0%

edited 05 May '15, 22:32

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

1

For info, there's a switch2osm page about this that might help:

https://switch2osm.org/using-tiles/getting-started-with-leaflet/

(05 May '15, 22:07) SomeoneElse ♦

This is AJAX I would prefer in JavaScript

(07 May '15, 13:23) Meku13
1

what about searching or asking on the leafletjs googlegroup mailinglist???

https://groups.google.com/forum/#!forum/leaflet-js

(08 May '15, 13:24) stephan75

One Answer:

0

You can get zoom level by map.getZoom() on zoom-level-change (see map-properties) and only if 17 or 18 you add/show your markers else you give an hint to zoom in

answered 08 May '15, 15:38

Harald%20Hartmann's gravatar image

Harald Hartmann
11135
accept rate: 33%

Source code available on GitHub .