bbox
Quick answer
bbox computes the smallest axis-aligned rectangle enclosing any GeoJSON object and returns [minX, minY, maxX, maxY]. Pass a FeatureCollection to get one envelope for the whole set. Use it for quick coarse filtering or to drive map.fitBounds, since the array also feeds MapLibre LngLatBounds and Leaflet bounds helpers.
turf.bbox( geojson ) → BBox
Key points
- Works on any geometry, feature or collection, including GeometryCollection.
- Coordinates are [west, south, east, north] in WGS84 degrees.
- bboxPolygon converts the array into a Polygon feature.
Example
var fc = turf.featureCollection([
turf.point([116.39, 39.90]),
turf.point([121.47, 31.23]),
turf.point([113.26, 23.12])
]);
var box = turf.bbox(fc);
console.log(box); // [113.26, 23.12, 121.47, 39.90]var rect = turf.bboxPolygon(box);
rect.properties = { kind: 'coverage' };
/* 反过来,从一个面取回外包矩形 */
console.log(turf.bbox(rect));
Notes
- Empty collections produce an undefined or infinite bbox that breaks later math.
- Data crossing the antimeridian yields a bbox spanning almost the whole globe.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). bbox. https://www.jingweizhi.com/en/turf/api/bbox.html (accessed 2026-11-03).