A GeoJSON object, such as a Feature, FeatureCollection or Geometry, or an array of them.
The bounding box as [west, south, east, north], or undefined for invalid input.
// From a Feature with existing bbox
const place = await geocodeOne('Amsterdam');
const bbox = bboxFromGeoJSON(place);
// Returns the bbox that came with the place
// From an array of GeoJSON objects
const multiBbox = bboxFromGeoJSON([place1, place2, place3]);
// Returns bbox encompassing all three places
Extracts or calculates a bounding box from GeoJSON objects.
bboxproperty wins over the geometry, as for Point features from TomTom services, whose bbox may cover a broader area than the point itself.A calculated box crosses the antimeridian, with
west > east, when that is the narrower way to enclose the input:[[179, 0], [-179, 0]]spans 358°, and[[179, 0], [181, 0]]gives[179, 0, -179, 0].