2

In my Bing Maps V6.3 implementation, I was able to center my map around an array of points using the following code.

map.SetMapView(latlonArray);
if (map.GetZoomLevel() > 10) {
    map.SetZoomLevel(10);
};

This code does not work in Bing Maps V7, and I can't find an alternative on the web.

Note: latlonArray is simply being populated as such

var increment = 0;
$.each(json_object, function () {
    latlonArray[increment] = new VELatLong(this.lat, this.lon);
    increment = ++increment;
});
Chase Florell
  • 46,378
  • 57
  • 186
  • 376

1 Answers1

3

You need the LocationRect.fromLocations() method. It accepts an array of locations, and returns a rectangle.

also: For v7, the new type representing a latitude/longitude location is Microsoft.Maps.Location , not VELatLong.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • Nice. I was always keeping track of min/max lat/lon when drawing results. Depending on how many pins you have, that may be faster. – Brian White Oct 21 '12 at 23:25