This crate wraps the H3O library and expose a C API that can be used as a drop in replacement for the H3 reference implementation.
Note that while the exposed API itself exacly matches the reference one, from a behavioral point of view there are some differences (that shouldn't matter in most cases but still: be aware of it).
For instances:
- when a function fails, the error code may differ between
h3
andh3oh3o
- due to the current implementation of h3's
compactCells
, some duplicates in the input may go undetected:h3oh3o
will detect them and returns an error. stringToH3
does no validity check on its input (beyond "is it an integer"), whereash3oh3o
ensure the parsed index's validity.- when the resolution given to
cellToChildrenSize
is coarser than the cell's one,h3
returns an error whereh3oh3o
returns a count of0
. - …
To use h3oh3o
as a C library in an external project, simply add the following
snippet to your CMakeLists.txt
# Include the H3OH3O library, fetch it if not locally available.
include(FetchContent)
FetchContent_Declare(
h3oh3o
GIT_REPOSITORY https://github.com/HydroniumLabs/h3oh3o.git
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(h3oh3o)
And then
target_link_libraries(your_target PUBLIC h3oh3o::h3oh3o)