Bing Virtual Earth 7.0计算区域 [英] Bing Virtual Earth 7.0 calculate area
问题描述
我有一张地图,在其中我为在Facebook上签到的所有地方创建了pushPin.我想放大检查位置最多的区域(pushPins).
I have a map where i have created pushPin for all the places i have checked in on facebook. I want to zoom in on the area where i have the most checkinplaces (pushPins).
我可以有一个静态的缩放级别并计算某种中值,但是如果我在巴黎进行20次签入,在洛杉矶进行20次签到,则最终会到达大西洋(或北太平洋)中部某个地方等).
I could have a static zoom level and calculate some kind of median value but if i check in 20 times in Paris and 20 times in Los Angeles I'd end up somewhere in the middle of the Atlantic Ocean (or the North Pacific or something).
我有一个数组,其中包含所有要使用的位置(经度和纬度).
I have an array with all the locations (longitudes and latitudes) to play with.
推荐答案
您可以使用LocationRect.fromLocations()方法(http://msdn.microsoft. com/zh-CN/library/gg427621.aspx).
You can create a bounding box that covers the extent of the pushpins in your array using the LocationRect.fromLocations() method (http://msdn.microsoft.com/en-us/library/gg427621.aspx).
然后,只需将LocationRect传递给map.setView方法的"bounds"属性,即可在该视图上居中放置地图. (http://msdn.microsoft.com/en-us/library/gg427628.aspx)
Then, simply centre the map on this view by passing the LocationRect to the "bounds" property of the map.setView method. (http://msdn.microsoft.com/en-us/library/gg427628.aspx)
这篇关于Bing Virtual Earth 7.0计算区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!