turf.envelope
What is turf.envelope?
turf.envelope takes any GeoJSON input and returns its axis-aligned rectangular bounding Polygon. It is functionally equivalent to calling turf.bboxPolygon(turf.bbox(input)) but wrapped in a single import and optimised to traverse coordinates only once.
turf.envelope(geojson) → Feature<Polygon>When would you use turf.envelope?
Use turf.envelope when you want the bounding box as drawable geometry rather than a four-element array — for example, to display an "active region" overlay around a FeatureCollection on MapLibre, or to feed the extent into a subsequent clip with turf.bboxClip or turf.intersect.
In Node.js, it is useful during tile generation and indexing — produce envelopes as spatial index entries and pass them to @turf/boolean-intersects for cheap first-pass filtering before more expensive exact checks.
undefinedFAQs
Is this the same as a convex hull?
No. An envelope is the axis-aligned rectangle (minimum bounding box). A convex hull (turf.convex) is the tightest convex polygon containing all vertices — typically much smaller and shape-aware. Use envelope for quick extents, convex for accurate coverage.
What does the returned polygon look like?
A rectangular Polygon Feature with a single exterior ring of five coordinates (four corners plus a closing duplicate), oriented counter-clockwise in geographic space.
How do I install just envelope?
npm install @turf/envelope. It depends on @turf/bbox-polygon and @turf/meta. If you already have those installed for other tasks, the extra footprint is negligible.
Does it handle antimeridian-crossing features?
No. Because it relies on simple min/max longitude, features that cross 180° produce an envelope spanning the whole globe. Split the geometry or normalise longitudes before calling envelope if antimeridian handling matters to you.