leaflet沿线标注,获取Leaflet中当前地图范围内的标记/图层列表

在Leaflet地图应用中,作者实现了一个搜索框,用于从服务器获取批量搜索结果并分页显示。当用户缩放或平移地图时,希望搜索结果列表仅显示当前地图边界内的标记。虽然可以通过服务器端或遍历所有标记来实现,但作者询问是否有一种内置的Leaflet方法可以获取当前视口内可见的图层。解决方案是使用一个插件,通过添加L.Control.ListMarkers到地图,可以显示当前视口内可见的标记列表。
摘要由CSDN通过智能技术生成

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 names & info) at once from a server and then pages through the list of results. So at any given point on the map there are two kinds of markers -- a background marker for points which are in the search results but not in the current page, and a foreground marker for points which are in the current page of search results.

All this works nicely.. what I'd like to do now is set it up so that if a user zooms or pans the map, the search results list updates to show only markers within the current map bounds.

Obviously there are server-side ways to do this, or I could also just run through the whole list of markers to see which fit within the current bounds; but does anybody know a built-in way to do this within l

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值