LanguageValues and typesStandard typesGeospatial
BoundingBox
On this page
A rectangle on a map, given by its four sides.
Use it for the visible part of a map or a rough search area. For an exact outline, use Polygon. For a distance around a place, use Circle.
Shape
Its parts keep these rules, and a value that breaks one fails with the rule's name:
south_not_above_north: south <= north
Example
BoundingBox { south: 51.28 west: -0.51 north: 51.69 east: 0.33 }This operation gives one: geo.bounding_box.
Good to know
- A box may cross the 180° meridian: its
westis then further east than itseast. Butsouthcan't be abovenorth. geo.bounding_boxgives the box around any shape.==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"south":"51.28","west":"-0.51","north":"51.69","east":"0.33"}{"south":"-20","west":"170","north":"-10","east":"-170"}
Details
Text form, storage, how it is shown, and operations
BoundingBox is in the group Geospatial, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 4 columns, each named for the field, _ and its suffix. This is {"south":"-20","west":"170","north":"-10","east":"-170"}:
| Column | Type | Holds |
|---|---|---|
<field>_south |
numeric |
-20 |
<field>_west |
numeric |
170 |
<field>_north |
numeric |
-10 |
<field>_east |
numeric |
-170 |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"south":"51.28","west":"-0.51","north":"51.69","east":"0.33"} |
51.28° N, 0.51° W – 51.69° N, 0.33° E |
{"south":"-20","west":"170","north":"-10","east":"-170"} |
20° S, 170° E – 10° S, 170° W |
Operations
geo.bounding_box(shape: T) -> BoundingBox: The smallest box of parallels and meridians holding the shape, an edge's highest or lowest point counted, across the antimeridian when that box is narrower; a shape holding a pole runs from -180 to 180.geo.contains(a: T, b: U) -> Bool: Whether no point ofblies outsidea, edges included.amay be aBoundingBox, whose sides are compared directly, or aCircle, holding the points within its radius of its centre.geo.within(a: T, b: U, distance: Length?) -> Bool:geo.contains(b, a); or, withdistance:, whether two points are at most that far apart, asgeo.distancemeasures them.
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-bounding-box.md.Built from Jadpo main at aee2e8f.