Map.centerObject

Centers the map view on a given object.

Caution: providing a large or complex collection as input can result in poor performance. Collating the geometry of collections does not scale well, use the smallest collection (or geometry) that is required to achieve the desired outcome.

Returns the map.

UsageReturns
Map.centerObject(object, zoom, onComplete)ui.Map
ArgumentTypeDetails
objectElement|Geometry

An object to center on - a geometry, image or feature.

zoomNumber, optional

The zoom level, from 0 to 24. If unspecified, computed based on the object's bounding box.

onCompleteFunction, optional

A callback which is triggered after the recentering completes successfully. Passing this parameter causes the

`centerObject` operation to run asynchronously.