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.
Summary
Types
Fallback for unsupported or malformed GeoJSON strings.
Supported typed geospatial values accepted by geo bins and filters.
Functions
Builds an Aerospike circle from center longitude, latitude, and radius.
Decodes a GeoJSON string into a typed value when the shape is supported.
Builds a point from longitude and latitude.
Builds a polygon from rings of {longitude, latitude} coordinate tuples.
Encodes a typed geo value as a GeoJSON string.
Types
@type raw_geojson() :: {:geojson, String.t()}
Fallback for unsupported or malformed GeoJSON strings.
@type t() :: Aerospike.Geo.Point.t() | Aerospike.Geo.Polygon.t() | Aerospike.Geo.Circle.t()
Supported typed geospatial values accepted by geo bins and filters.
Functions
@spec circle(number(), number(), number()) :: Aerospike.Geo.Circle.t()
Builds an Aerospike circle from center longitude, latitude, and radius.
@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.
@spec point(number(), number()) :: Aerospike.Geo.Point.t()
Builds a point from longitude and latitude.
@spec polygon([[{number(), number()}]]) :: Aerospike.Geo.Polygon.t()
Builds a polygon from rings of {longitude, latitude} coordinate tuples.
Encodes a typed geo value as a GeoJSON string.