Get a list of markers/layers within current map bounds in Leaflet

前端 未结 4 1345
面向向阳花
面向向阳花 2020-12-31 03:46

This is somewhat similar to the question asked here --

I\'m writing a search box for a map application, which retrieves a whole set of search results (people\'s name

4条回答
  •  余生分开走
    2020-12-31 04:02

    Regarding the last part of your question, if you want to iterate through visible layers, you can use eachLayer, e.g:

    map.eachLayer(function (layer) {
        // do something with the layer
    });
    

    API reference: http://leafletjs.com/reference.html#map-stuff-methods

提交回复
热议问题