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).
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);
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