问题
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).
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.
回答1:
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).
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)
来源:https://stackoverflow.com/questions/7107536/bing-virtual-earth-7-0-calculate-area