How the Bounding Box Calculator works, and what it assumes

Every position in the geometry is visited, whatever its type or nesting, and the smallest axis-aligned rectangle containing all of them is reported. A MultiPolygon, a GeometryCollection or a FeatureCollection is handled the same way as a single point: the box covers everything in it.

The reason this needs a tool rather than four Math.min calls is that the four numbers are written differently by everything that consumes them. GeoJSON's bbox is minimum longitude first. A WMS 1.1.1 request is the same. A WMS 1.3.0 request in a geographic CRS is latitude first, because 1.3.0 follows the axis order the CRS defines and EPSG defines EPSG:4326 as latitude then longitude. GDAL's -projwin takes upper-left then lower-right, while its -te takes the same four numbers as GeoJSON. Leaflet takes two corner pairs, each latitude first. Each of those is produced ready to copy.

One case has no honest answer. A geometry crossing the antimeridian at 180 degrees has positions at both edges of the world, so the minimum and maximum longitude span everything in between and the box covers the globe. That is what a four-number box can express; the fix is to split the geometry at the antimeridian, which GeoJSON's RFC recommends for exactly this reason.

Using the Bounding Box Calculator

  • Filling in the BBOX parameter of a WMS or WFS request from geometry you already have.
  • Setting the initial view of a web map so it opens on the data rather than on the whole world.
  • Clipping a raster with gdal_translate or gdalwarp, which want the corners in their own order.
  • Writing a spatial index filter or an envelope predicate for a database query.

A worked example

A line string through central London:

LINESTRING (-0.1425 51.5015, -0.1245 51.5095, -0.0983 51.5033, -0.0759 51.5081)

gives:

GeoJSON bbox           [-0.1425, 51.5015, -0.0759, 51.5095]
WMS 1.1.1 BBOX         -0.1425,51.5015,-0.0759,51.5095
WMS 1.3.0 EPSG:4326    51.5015,-0.1425,51.5095,-0.0759
Leaflet LatLngBounds   [[51.5015, -0.1425], [51.5095, -0.0759]]
GDAL -projwin          -0.1425 51.5095 -0.0759 51.5015
WKT polygon            POLYGON ((-0.1425 51.5015, -0.0759 51.5015, -0.0759 51.5095,
                                 -0.1425 51.5095, -0.1425 51.5015))

Note that the first and third rows hold the same four numbers in a different order. Copying the wrong one is the most common reason a WMS request returns a blank image: the server is asked for somewhere in the Indian Ocean and politely returns the empty sea that is there.

Where this comes up in GIS work

  1. Paste a geometry as WKT or GeoJSON, open a file, or select Load example.
  2. Select Calculate bounding box, or press Ctrl + Enter (Cmd + Enter on a Mac).
  3. Pick the row that matches the system you are feeding, and select Copy.
  4. Download the extent as a GeoJSON Feature if you want the box itself as geometry.

When the output looks wrong

The box spans the whole world for a small geometry
The geometry crosses the antimeridian at 180 degrees, so its minimum and maximum longitudes sit at opposite edges of the world. A four-number box cannot express a span that wraps; splitting the geometry at the antimeridian is the usual fix.
A WMS request drawn from this box comes back empty
Check which row you copied. A WMS 1.3.0 request in a geographic CRS such as EPSG:4326 expects minimum latitude first, while 1.1.1 always expects minimum longitude first. Copying the wrong one is the single most common cause of an empty WMS image.
The extent on the ground is not shown
The coordinates fall outside the longitude and latitude range, so they are projected rather than geographic. The tool will not convert projected units into a ground distance without knowing the coordinate system, so it reports the span in the input units instead.
The box is larger than the shape it contains
That is what an axis-aligned bounding box is. A diagonal line or a rotated rectangle fills only part of its envelope; a convex hull or the geometry itself is what you want if the extra area matters.

Questions about the Bounding Box Calculator

Which output formats are produced?

The GeoJSON bbox array, a plain comma-separated list, a WKT polygon of the box, the WMS 1.1.1 and 1.3.0 forms, the GDAL -projwin and -te orders, Leaflet's LatLngBounds, and west/south/east/north. The list adapts to whether the coordinates are geographic.

Why does WMS 1.3.0 need a different order?

Because 1.3.0 follows the axis order that the CRS itself defines, and EPSG defines EPSG:4326 as latitude then longitude. WMS 1.1.1 always used x then y regardless of the CRS. CRS:84 exists so a 1.3.0 request can ask for longitude first explicitly.

How is the extent on the ground measured?

Across the middle of the box for the width and along its western edge for the height, using great-circle distances. It is a description of the box's size, not a diagonal, and it is only shown when the coordinates are geographic degrees.

Does it handle a MultiPolygon or a GeometryCollection?

Yes. Every position in the geometry is considered, whatever its type or nesting, and the result is the smallest axis-aligned box that contains all of them.

Is my geometry sent anywhere?

No. The geometry is parsed and measured in your browser, and nothing you paste or open leaves your device.