All sections

Bounding Boxes

A [west, south, east, north] envelope — a map viewport or query bound, not a shape describing any real-world extent — and the ordering and antimeridian bugs that follow from treating it as one anyway.

stableh34 min read
Source geometry
bounding_box

A bounding box is an envelope — [west, south, east, north] — that describes the extent of a map viewport or a query's search bounds. It is not a shape describing any real place: nothing about a store's coverage or a region's outline is naturally rectangular, and a bounding box used as a targeting or reporting geometry is almost always a stand-in for "everything visible on screen right now" or "everything the caller asked to search within," not a deliberate footprint. Treating a bounding box as if it carries the same intent as a drawn polygon is the family's core conceptual risk; treating it as a trivial four-number rectangle with no edge cases is the family's core implementation risk.

Cardinality
One rectangle — never a partition, never a real footprint
Governed by
Whatever client or query produced it — a viewport state or search parameter
Not a geometry
A saved market label attached to a live, constantly-changing viewport rectangle
Converts via
Corner-to-polygon construction (antimeridian-aware), then polyfill

Members

MemberWhat it boundsTypical origin
Map viewportThe currently visible map extentClient-side map state (pan/zoom)
Search boundsA geocoder or places-API query restrictionAPI request parameter
API query envelopeA spatial filter on a data queryQuery parameter
Market extentA rough rectangular stand-in for a market's footprintManually specified, often for a quick estimate

Required metadata

FieldWhy it's required
CRSStandard EPSG:4326 assumption, but verify — some mapping SDKs report viewport bounds in Web Mercator
Screen vs. geographicA screen-space rectangle and a true geographic envelope are easy to conflate but behave differently near the poles and the antimeridian
Coordinate order convention[west, south, east, north] is one common convention; [minLng, minLat, maxLng, maxLat] is numerically identical but callers still transpose lat/lng within it

Common risks

Antimeridian crossing: when a box crosses ±180° longitude, west is numerically greater than east (e.g. west=170, east=-170 for a box spanning the ±180° line near Fiji) — a naive box-to-polygon conversion that assumes west < east either produces an inverted rectangle or, worse, a box that silently spans the entire globe the wrong way. This is common enough near the Pacific that any bounding-box conversion needs an explicit antimeridian check, not an assumption that it won't happen; see antimeridian handling. Rotated boxes: some viewport-derived bounds are not axis-aligned (a rotated map view), and a [west, south, east, north] tuple cannot represent rotation at all — if the source system supports rotation, the bounding box handed to a conversion may already be a lossy axis-aligned approximation of the true viewport, and that loss should be disclosed rather than treated as exact. Screen vs. geographic conflation: a screen/viewport rectangle changes with every pan and zoom and is not a stable geometry to persist or report against, while a geographic envelope (a market extent, a search radius expressed as a box) is meant to be stable; using a live viewport bound as if it were a saved market definition silently changes the "region" every time a user's map state changes. West/east ordering assumptions: distinct from the antimeridian case, some upstream systems deliver bounds already reordered (min/max rather than west/east), and assuming the tuple order matches the field names without checking produces a box that is numerically valid but geographically wrong.

A bounding box is not a market boundary

A market extent expressed as a bounding box is a rectangle that happens to contain the market, not a shape describing it — it will always include territory the market doesn't actually cover. Where a real market footprint is needed rather than a quick rectangular estimate, use arbitrary polygons or administrative boundaries instead.

How it converts to H3

A bounding box converts to H3 by first constructing a four-vertex polygon from its corners — handling the antimeridian sign flip explicitly — and then polyfilling that polygon under the same containment modes used for any other polygon. See bounding box to H3 for the corner-construction algorithm and the antimeridian-safe splitting logic, and coordinate and CRS failures for the broader class of ordering and projection mistakes that a bounding box is especially prone to surfacing, since a four-number rectangle offers no redundancy to catch a transposed coordinate the way a denser polygon ring sometimes does.

Edge cases affecting this page
  • - Geometries crossing ±180° longitude wrap incorrectly, producing world-spanning artifacts when treated as planar.