Hive state v0.0.1 Hive.H3 View Source

Interfaces with Erlang H3 and provides abstraction layer to work with vehicles or %GeoPosition{}.

Usage

iex> Hive.H3.num_hexagons(resolution)

Link to this section Summary

Functions

Convert string representation of H3 index to numeric index value.

Returns the resolution of the index.

Indexes the location for given vehicle_id at the specified resolution

Returns index from %GeoPosition{}

Returns the %GeoPosition{} center of the cell from numeric index

Get all hexagons in a k-ring around a given center and a distance.

Check if given index represents a pentagonal cell

Returns bounds for index

Convert string representation of H3 index to numeric index value.

Link to this section Types

Link to this type

resolution()

View Source
resolution() ::
  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
Link to this type

vehicle_id()

View Source
vehicle_id() :: binary()

Link to this section Functions

Link to this function

from_string(index)

View Source
from_string(binary()) :: h3_index()

Convert string representation of H3 index to numeric index value.

Example:

iex> Hive.H3.from_string("8928308280fffff")

Link to this function

get_resolution(index)

View Source
get_resolution(h3_index()) :: resolution()

Returns the resolution of the index.

Link to this function

index(vehicle_id, resolution)

View Source
index(Hive.GeoPosition.t(), resolution()) :: h3_index()
index(vehicle_id(), resolution()) :: h3_index()

Indexes the location for given vehicle_id at the specified resolution

Link to this function

index_from_geo(position, resolution)

View Source
index_from_geo(Hive.GeoPosition.t(), resolution()) :: h3_index()

Returns index from %GeoPosition{}

Link to this function

index_to_geo(index)

View Source
index_to_geo(binary()) :: Hive.GeoPosition.t()
index_to_geo(h3_index()) :: Hive.GeoPosition.t()

Returns the %GeoPosition{} center of the cell from numeric index

Link to this function

k_ring(index, distance)

View Source
k_ring(binary(), non_neg_integer()) :: [h3_index()]
k_ring(h3_index(), non_neg_integer()) :: [h3_index()]

Get all hexagons in a k-ring around a given center and a distance.

Link to this function

pentagon?(index)

View Source
pentagon?(h3_index()) :: boolean()

Check if given index represents a pentagonal cell

Link to this function

to_geo_boundary(index)

View Source
to_geo_boundary(binary()) :: [Hive.GeoPosition.t()]
to_geo_boundary(h3_index()) :: [Hive.GeoPosition.t()]

Returns bounds for index

Link to this function

to_hex_string(index)

View Source
to_hex_string(non_neg_integer()) :: binary()

Convert string representation of H3 index to numeric index value.

Example:

iex> Hive.H3.to_string(617_700_169_958_293_503)