ocaml-h3: OCaml bindings to Uber's H3 geospatial indexing system

April 6, 2018 ยท View on GitHub

Build Status License

Summary

Experimental bindings to Uber's H3 C library for indexing geo points.

Dependencies

First install H3 per the H3 readme instructions.

Example

Simple example using utop. First:

$ jbuilder utop src

Then within utop

utop # let paris = {H3.lat=48.8566; H3.lon=2.3522};;
val paris : H3.geo_coord = {H3.lat = 48.8566; lon = 2.3522}

utop # let paris_h3 = H3.h3_of_geo_coord paris 9;;
val paris_h3 : int64 = 617550903642685439L

utop # Printf.printf "%Lx" paris_h3;;
891fb466257ffff- : unit = ()

See also examples/index.ml and examples/distance.ml which should exactly match the index.c and distance.c in the upstream Uber H3 C library.