简体   繁体   English

如何根据缩放级别在必应地图上显示一定数量的PushPins?

[英]How to display certain amounts of PushPins on a Bing Map according to the zoom level?

In my web application a PushPin represents a device located in a region, it displays PushPins on a Bing Map depending on two operations: 在我的Web应用程序中,PushPin表示位于某个区域中的设备,它根据两个操作在Bing Map上显示PushPins:

  • One is that when the user wants to display of all the devices registered. 一种是当用户想要显示所有注册的设备时。

  • The second one is when the sever sends a signal to the web site that a particular device must be shown. 第二个是当服务器向网站发送信号时,必须显示特定的设备。

The thing is that there are several devices in a region and when the map is zoomed out at level 5 they all look quite messy. 事实是,一个区域中有多个设备,当将地图缩小到5级时,它们看上去都非常混乱。

Is there a way to limit the amount of exisiting PushPins displayed on a Bing Map depending on the zoom level? 有没有一种方法可以根据缩放级别限制在Bing Map上显示的现有PushPin数量? Like at level 5 only show one PushPin and on higher zoom level increase the amount displayed, so that at level 15 all existing PushPins are shown. 与第5级一样,仅显示一个PushPin,而在较高的缩放级别上,则增加显示的数量,因此在第15级,将显示所有现有的PushPin。

I tried the EnableShapeDisplayThreshold method, but it seems that only works for polylines and polygons, not PushPins. 我尝试了EnableShapeDisplayThreshold方法,但似乎仅适用于折线和多边形,不适用于PushPins。

Any help will be appreciated. 任何帮助将不胜感激。 Thanks in advance. 提前致谢。

What you want to do is to use is called clustering, it's grouping the marker (pushpins) depending on the level of zoom and current map view. 您想要使用的就是所谓的聚类,它根据缩放级别和当前地图视图对标记(图钉)进行分组。

Reference: 参考:

Based on the method you're currently using ( EnableShapeDisplayThreshold ), I assume that you're using v6.3 so you should be able to use the VEShapeLayer.SetClusteringConfiguration() method: 根据您当前使用的方法( EnableShapeDisplayThreshold ),我假设您使用的是v6.3,因此您应该能够使用VEShapeLayer.SetClusteringConfiguration()方法:

http://msdn.microsoft.com/en-us/library/cc966930.aspx http://msdn.microsoft.com/en-us/library/cc966930.aspx

Sample code: 样例代码:

Here in action : http://msdn.microsoft.com/en-us/library/cc980909.aspx 在这里起作用: http : //msdn.microsoft.com/en-us/library/cc980909.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM