JS API
Map Object
QueryEngine Object
Layer Object
Feature Object
Query Object
GeoJson Function Library (Experimental)

fitToBoundingBox

Sets the map view to contain a bounding box.

Parameters

Name Required Description
bbox Yes The bounding box that you want to contain in the view. If the bounding box has a different aspect ratio to the map, the map will make sure everything in the bounding box is visible.

The format of the bbox parameter is an array of numbers and conforms to the GeoJSON standard for a bounding box i.e. [minX, minY, maxX, maxY] where:

- minX (The minimum x-value of the bounding box)
- minY (The minimum y-value of the bounding box)
- maxX (The maximum x-value of the bounding box)
- maxY (The maximum y-value of the bounding box)
buffer No Expands (or contracts) the BoundingBox by this ratio. For example a value of 2 will make the bounding box twice as big and a value of 0.5 will make it half the size.

Example

var map = new Mapzania.Map("map-div", "WORLD");
map.fitToBoundingBox([12.1,3.4,14.3,4.2], 1.25);