JavaScript

mapControl.setCenter Method

Syntax

mapObj.setCenter(location [, pan]);

Arguments

locationstringarray

The location to center the map, specified as either an address or latitude/longitude value passed in as an array (e.g. [42,-71]).

panboolean

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

Description

Set the center of the Map Control's view.

Example

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

if (mapObj) {
    // center on a lat/lng
    mapObj.setCenter([42.1,-71.3],true);

    // center on an address
    mapObj.setCenter('70 Blanchard Road Burlington, MA');
}