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).
var southWest = new mapboxgl.LngLat(-73.9876, 40.7661); var northEast = new mapboxgl.LngLat(-73.9397, 40.8002); var boundingBox = new mapboxgl.LngLatBounds(southWest, northEast);
Any Mapbox library that creates maps or initiates geocoding requests has a class or object for using bounding boxes in your code:
- Mapbox Geocoding API
- Mapbox GL JS
- Mapbox Maps SDK for iOS
- Mapbox Maps SDK for Android
- Mapbox Java SDK