# `GeoGenius.Providers.GeoJSON`
[🔗](https://github.com/agoodway/geo_genius/blob/main/lib/geo_genius/providers/geo_json.ex#L1)

Provider for a single GeoJSON `FeatureCollection` artifact.

One feature becomes one staged row: `payload` is the feature's
`"properties"` map, `geom` is its decoded geometry or `nil` for a feature
that carries none. `normalize/2` reads the code and name out of `payload`
using the manifest's `options`, so the same module serves any collection
whose properties name their code and display name differently.

`required_options/0` requires `"area_type"` and `"code_property"`. The
remaining `options` keys are optional:

  * `"name_property"` -- defaults to `"name"`.
  * `"authority"` -- defaults to the manifest's own authority, when it
    declares exactly one.
  * `"attribute_properties"` -- a list; defaults to `[]`.
  * `"alias_properties"` -- a list; defaults to `[]`.
  * `"code_properties"` -- a list of `%{"type" => ..., "property" => ...}`;
    defaults to `[]`.

See the option-vocabulary table in `GeoGenius.Provider`'s moduledoc for how
these correspond to `GeoGenius.Providers.CSV`'s own option keys.

# `artifacts`

```elixir
@spec artifacts(GeoGenius.Manifest.t()) :: [GeoGenius.Manifest.Artifact.t()]
```

Every artifact declared across the manifest's sources; a GeoJSON collection's artifacts are all GeoJSON.

# `asserted_relations`

```elixir
@spec asserted_relations(GeoGenius.Manifest.t(), GeoGenius.Staging.Row.t()) :: [
  {String.t(), String.t(), String.t()}
]
```

Asserts an edge from each area the row implies to the row's own area.

# `normalize`

```elixir
@spec normalize(GeoGenius.Manifest.t(), GeoGenius.Staging.Row.t()) ::
  {:ok, GeoGenius.Provider.Area.t()}
  | {:ok, [GeoGenius.Provider.Area.t()]}
  | :skip
  | {:error, String.t()}
```

Reads the code and name out of the staged row's payload, using the manifest's options.

# `relations`

```elixir
@spec relations(GeoGenius.Manifest.t()) :: :rebuild
```

GeoJSON areas carry no hierarchy of their own; relations are always rebuilt.

# `required_options`

```elixir
@spec required_options() :: [String.t()]
```

Requires `area_type` and `code_property` in the manifest's options.

# `stage`

```elixir
@spec stage(
  GeoGenius.Manifest.t(),
  GeoGenius.Manifest.Artifact.t(),
  Path.t(),
  ([GeoGenius.Staging.Row.t()] -&gt; :ok),
  GeoGenius.Provider.stage_opts()
) :: :ok | {:error, GeoGenius.Provider.reason()}
```

Reads `path` as a GeoJSON `FeatureCollection` and emits its features in
chunks of 1000 rows.

# `validate_options`

```elixir
@spec validate_options(map()) :: :ok | {:error, String.t()}
```

Validates the manifest's `implied_areas` entries, whose code key is `code_property`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
