LanguageValues and typesStandard typesGeospatial
FeatureCollection
On this page
A list of features, all with the same shape and properties types, as a map layer.
Use it to send many shapes to a map library in one response. For one shape, use Feature.
Shape
| Field | Type | Required? |
|---|---|---|
features |
List<Feature<G, P>> |
Yes |
Example
type LayerStop = Object { name: Text}var layer: FeatureCollection<Point, LayerStop> = FeatureCollection { features: [] }assert layer.features == []
Good to know
- Name both types when you use it:
FeatureCollection<Point, LayerStop>. ==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":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}}]}{"type":"FeatureCollection","features":[]}
Details
Text form, storage, how it is shown, and operations
FeatureCollection 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":"FeatureCollection","features":[]} is stored as '{"type":"FeatureCollection","features":[]}'::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":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}}]} |
"" |
{"type":"FeatureCollection","features":[]} |
"" |
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-collection.md.Built from Jadpo main at aee2e8f.