Circle
A centre and a radius on the ground, the radius never below 0: shown 1,000 m around 51.5072° N, 0.1276° W.
Geospatial; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, Circle { centre: ... radius: ... }.
Fields
Text, JSON and storage
It has no single text form, so text.from and text.parse don't take it. JSON sends an object of its parts.
| JSON |
|---|
{"centre":{"type":"Point","coordinates":[-0.1276,51.5072]},"radius":{"value":"1000","unit":"metre"}} |
{"centre":{"type":"Point","coordinates":[0,0]},"radius":{"value":"0","unit":"metre"}} |
It is stored in 2 columns, each named for the field, _ and its suffix. This is {"centre":{"type":"Point","coordinates":[0,0]},"radius":{"value":"0","unit":"metre"}}:
| Column | Type | Holds |
|---|---|---|
<field>_centre |
geography |
'SRID=4326;POINT (0 0)'::geography |
<field>_radius |
numeric(38, 6) |
0 |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"centre":{"type":"Point","coordinates":[-0.1276,51.5072]},"radius":{"value":"1000","unit":"metre"}} |
1,000 m around 51.5072° N, 0.1276° W |
{"centre":{"type":"Point","coordinates":[0,0]},"radius":{"value":"0","unit":"metre"}} |
0 m around 0°, 0° |
Operations
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.
Like every standard type, it also has the contract's own operations: text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-circle.md.Built from Jadpo main at e00e61f.