JavaScript

mapControl.view Method

Syntax

mapObj.view(location1, location2 [,...locationN [, pan]]);

mapObj.plotRoute(locationArray [, pan]);

Arguments

location1stringarray

The first location, specified as an array containing latitude/longitude values, to include in the view calculation.

location2stringarray

The second location, specified as an array containing latitude/longitude values, to include in the view calculation.

locationNstringarray

Additional location(s), specified as an array containing latitude/longitude values, to include in the view calculation. You can specify as many additional locations as you want.

locationArrayarray

An array of locations, each specified as an array containing latitude/longitude values, to include in the view calculation.

panboolean

A true/false value. If true, the Map Control will animate, or 'pan', to the new location.

Description

Adjusts the Map Control's center point and zoom to view multiple latitude/longitude locations.

Discussion

You can optionally pass in a boolean as the last parameter to specify if you would like the view to be panned (animated) to the new location.

Example

//get a pointer to the map control for variable 'mymap1'
var mapObj = {dialog.object}.getControl('mymap1');

if (mapObj) {
    var locs = [[42.1,-71.3],[42.12,-71.34],[41.234,-73.1]];
    var pan = true;
    mapObj.view(locs,pan);
}