如何在当前缩放级别获取所有可见标记 [英] How to get all visible markers on current zoom level

查看:129
本文介绍了如何在当前缩放级别获取所有可见标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是一些要点:


  1. 我在地图上标记了一些标记,并在地图上的右侧显示了与它相关的记录。它们通过数字ID连接,数字ID作为标记的属性存储。

  2. 所有标记都存储在一个数组中。

  3. 当用户放大地图,只有可见标记相关的记录应显示在右侧面板上。

那么,如何获取列表在当前缩放级别上的所有可见标记?我在互联网上搜索,没有找到有用的东西。某些我想达到的目标可以在这里找到

解决方案使用 GMap2.getBounds()来查找边界框。使用 GLatLngBounds.containsLatLng()来检查每个标记是否可见。


Here are some points:

  1. I have some markers on the map and records associated with it on the right panel besides the map. They are connected via numeric id, which is stored as a property of marker.
  2. All the markers are stored in an array.
  3. When the user zooms in the map, records, associated to only visible markers should be shown on the right panel.

So, how to get the list of all visible markers on the current zoom level? I've searched over the internet and didn't find something useful. Some kind of what I'm trying to achieve could be found here

解决方案

Use GMap2.getBounds() to find the bounding box. The use GLatLngBounds.containsLatLng() to check each marker to see if it is visible.

这篇关于如何在当前缩放级别获取所有可见标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆