All docschevron-rightHelpchevron-rightarrow-leftGlossarychevron-rightbounding box

bounding box

A bounding box is a mechanism for describing a particular area of a map. It is typically expressed as an array of coordinate pairs, with the first coordinate pair referring to the southwestern corner of the box (the minimum longitude and latitude) and the second referring to the northeastern corner of the box (the maximum longitude and latitude).

This Mapbox GL JS example creates a bounding box using the LngLatBounds method:

const southWest = new mapboxgl.LngLat(-73.9876, 40.7661);
const northEast = new mapboxgl.LngLat(-73.9397, 40.8002);
const boundingBox = new mapboxgl.LngLatBounds(southWest, northEast);

Related resources:

Any Mapbox library that creates maps or initiates geocoding requests has a class or object for using bounding boxes in your code:

Was this page helpful?