When a map app shows cafes near you, it does not begin by measuring the exact distance to every cafe on Earth. It first draws a rectangle, a bounding box, around your position: the smallest box aligned to latitude and longitude that contains the circle you asked about. Checking whether a point falls inside a rectangle is just four comparisons, so millions of places can be filtered in a blink. Only the survivors get the expensive exact distance calculation. This two step approach, box then circle, sits inside almost every location search, delivery app and property site you have ever used.The rectangle trick is older than computers. Card catalogues, filing cabinets and the index of a printed atlas all filter by a coarse box first, whether that box is made of letters, drawers or degrees.
The north and south edges come from the radius divided by the length of a degree of latitude, which is nearly constant. The east and west edges need the radius divided by the length of a degree of longitude at that latitude, which grows as the cosine shrinks, so boxes get wider in degrees towards the poles. Two awkward cases need care: a box near a pole may cover every longitude at once, and a box crossing the 180 degree line wraps around, so its east edge reads as a smaller number than its west edge, which software must handle gracefully or searches near Fiji break.Developers meet the wrap problem in testing: a search centred near Fiji or Tonga that forgets the date line quietly returns nothing from one side, a bug that has shipped in real products more than once.
Bounding boxes are also the unit of map data itself. Satellite imagery, elevation models and map tiles are all stored and traded as rectangles with stated edges, because a rectangle is the only shape a filing system truly loves. When a weather service warns of storms within a box, or a shipping forecast names a sea area, it is using the same device. Understanding boxes explains some odd app behaviour too: a place just outside your circle can appear in early results because it sits inside the corners of the box, before the exact distance check quietly removes it.When you download open map data for a region, the file is almost always described by its bounding box, four numbers that act as the label on the crate the data arrives in.