# `Aerospike.Geo`
[🔗](https://github.com/luisgabrielroldan/aerospike_driver/blob/v0.3.1/lib/aerospike/geo.ex#L1)

Typed geospatial values for Aerospike GeoJSON bins.

Use `point/2`, `polygon/1`, and `circle/3` to build values that can be
written directly to geo bins. `to_json/1` and `from_json/1` convert between
those structs and GeoJSON strings.

Unsupported or malformed GeoJSON is preserved as `{:geojson, json}` so
callers can keep round-tripping values the client does not model directly.

# `raw_geojson`

```elixir
@type raw_geojson() :: {:geojson, String.t()}
```

Fallback for unsupported or malformed GeoJSON strings.

# `t`

```elixir
@type t() ::
  Aerospike.Geo.Point.t() | Aerospike.Geo.Polygon.t() | Aerospike.Geo.Circle.t()
```

Supported typed geospatial values accepted by geo bins and filters.

# `circle`

```elixir
@spec circle(number(), number(), number()) :: Aerospike.Geo.Circle.t()
```

Builds an Aerospike circle from center longitude, latitude, and radius.

# `from_json`

```elixir
@spec from_json(String.t()) :: t() | raw_geojson()
```

Decodes a GeoJSON string into a typed value when the shape is supported.

Unknown geometry types, unsupported coordinate shapes, and invalid JSON return
`{:geojson, json}` with the original string.

# `point`

```elixir
@spec point(number(), number()) :: Aerospike.Geo.Point.t()
```

Builds a point from longitude and latitude.

# `polygon`

```elixir
@spec polygon([[{number(), number()}]]) :: Aerospike.Geo.Polygon.t()
```

Builds a polygon from rings of `{longitude, latitude}` coordinate tuples.

# `to_json`

```elixir
@spec to_json(t()) :: String.t()
```

Encodes a typed geo value as a GeoJSON string.

---

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