SiteWatch API Help

setCenter

setCenter

Previous topic Next topic  

setCenter

Previous topic Next topic  

setCenter is a method that sets the map center location to map coordinates and zoom level and does a zoomIn or zoomOut depending on the previous zoom level.

 

Parameter

Value

point: a point set object(s) (SWPoint)

-or-

point: a point set array

isn93 map point locations.

zoom: integer (optional)

Zoom level (0 = highest, 10 = lowest).

 

Example:

var point = SWPoint.create(359583, 406481);

 

map.setCenter(point, 5);

 

Or

 

var point = SWPoint.create(359583, 406481);

 

map.setCenter(point, map.getZoom());

 

Or to zoom in to many map coordinates around the centermost map coordinate

 

map.setCenter([{ x: 359583, y: 406481 }, { x: 359603, y: 406471 }]);

 

Or

 

var point1 = SWPoint.create(359583, 406481);

var point2 = SWPoint.create(359603, 406471);

var point3 = SWPoint.create(359623, 406461);

var point4 = SWPoint.create(359643, 406451);

 

map.setCenter([point1, point2, point3, point4]);