Bounding Box

From OpenStreetMap Wiki
Jump to navigation Jump to search

A bounding box (usually shortened to bbox) is an area defined by two longitudes and two latitudes, where:

  • Latitude is a decimal number between -90.0 and 90.0.
  • Longitude is a decimal number between -180.0 and 180.0.

They usually follow the standard format of:

bbox = left,bottom,right,top
bbox = min Longitude , min Latitude , max Longitude , max Latitude 

For example, Greater London is enclosed by:

{{bbox|-0.489|51.28|0.236|51.686}}
(bbox=-0.489,51.28,0.236,51.686)

The "export data" link on the main website allows you to draw a box, and the coordinates of the edges are shown to you.

In a WikiProject having a params sub-page, you can get the bounding box by using the template pBbox.

Nominatim API

Nominatim API returns a boundingbox property of the form:

 south Latitude, north Latitude, west Longitude, east Longitude

For example, Greater London in JSON format:

 "boundingbox":["51.2867602","51.6918741","-0.5103751","0.3340155"]

Visually defining a bounding box

Several utilities have been created by the community to provide a graphical interface for selecting a bounding box on a reference map:

The map on the OpenStreetMap website can also be used:

  1. While viewing the map, click Export.
  2. Choose Manually select a different area.
  3. Drag the corners of the box to adjust the selection.
  4. Copy the coordinates from the left side of the screen.
  5. Cancel the data export by clicking the X.

osmconvert

See Osmconvert#Applying_Geographical_Borders

Changing an Overpass Turbo query to work within the displayed area on screen

Add "({{bbox}})" before the relevant semicolon, for example change:

relation["name"];

to

relation["name"]({{bbox}});

Overpass API

The order of values in the bounding box used by Overpass API is (South, West, North, East):

minimum latitude, minimum longitude, maximum latitude, maximum longitude  

See more details in the Overpass API Wiki.