# `FeatureCollection`

A GeoJSON `FeatureCollection`: features of one geometry type and one properties type, in order, as a map library takes a layer.

[Geospatial](types.md#geospatial); not ordered; since Jadpo 0.1.0.

## Make one

Build one from its fields, `FeatureCollection { features: ... }`.

## Fields

| Field | Type |
|---|---|
| `features` | `List<`[`Feature`](type-feature.md)`<G, P>>` |

## Text, JSON and storage

It has no single text form, so `text.from` and `text.parse` don't take it. JSON sends a GeoJSON object of its geometry and properties.

| JSON |
|---|
| `{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-0.1276,51.5072]},"properties":{"name":"Site A"}}]}` |
| `{"type":"FeatureCollection","features":[]}` |

It is stored in one column named for the field, of type `jsonb`. `{"type":"FeatureCollection","features":[]}` is stored as `'{"type":"FeatureCollection","features":[]}'::jsonb`.

## 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 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](../topics/every-standard-type-meets-one-contract.md) says how they work.
