Skip to content

helium/erlang-h3

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

erlang-h3

CI Hex.pm

The erlang-h3 library provides an Erlang binding for Uber's H3 spatial coordinate library.

Install

Add h3 to your deps section in rebar.config:

{deps, [h3]}.

Building

Fork the repo and simply use make to build the library. You will need cmake installed to build the required h3 core package.

To run the tests run make test.

Cross compilation

Cross-compilation requires the environment variable ERTS_INCLUDE_DIR defined as the target directory containing erl_nif.h, e.g. ERTS_INCLUDE_DIR=target/usr/lib/erlang/erts-<VERSION>/include.

Usage

The h3 module exports most of the functions from the core H3 library.

Like the JavaScript version the Erlang binding uses degrees instead of radians when converting to and from geo-coordinates to h3 indexes.

Example using ./rebar3 shell after cloning the repo:

$ ./rebar3 shell
...

1> Paris = h3:from_geo({48.8566, 2.3522}, 9).
617550903642685439
2> h3:to_string(Paris).
"891fb466257ffff"
3> h3:to_geo(Paris).
{48.857078058197295,2.3529900909549206}

About

Erlang binding for Uber's H3 spatial coordinate library

Resources

License

Stars

Watchers

Forks

Packages

No packages published