LanguageValues and typesStandard typesGeospatial
Feature
On this page
A shape with your own data attached, in GeoJSON's form, as a map library takes one.
Use it to send one shape and its properties to a map. To send a whole layer, use FeatureCollection. Inside your app, store your own records with a Point or Polygon field.
Shape
| Field | Type | Required? |
|---|---|---|
geometry |
G |
Yes |
properties |
P |
Yes |
Example
type StopInfo = Object { name: Text}var stop: Feature<Point, StopInfo> = Feature { geometry: Point { latitude: 51.5072 longitude: -0.1276 altitude: none } properties: StopInfo { name: "Charing Cross" }}assert stop.properties.name == "Charing Cross"
Good to know
- Name both types when you use it, the geometry and the properties:
Feature<Point, StopInfo>. The geometry can be one of the six shapes orGeometry. - It has no
id, so an incoming feature with one is refused. ==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
A GeoJSON object of its geometry and properties, in a request, a response or json.write:
{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}}Details
Text form, storage, how it is shown, and operations
Feature 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 one column named for the field, of type jsonb. {"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}} is stored as '{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}}'::jsonb.
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}} |
"" |
Operations
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-feature.md.Built from Jadpo main at aee2e8f.