Skip to content

nuwansa/h3-duckdb

 
 

Repository files navigation

tests DuckDB Version H3 Version License

To build, type:

git submodule update --init
GEN=ninja make duckdb_release release

(You will need Git, CMake, and a C compiler. You do not strictly need Ninja. See below for other options.)

To run, run the bundled duckdb shell:

./duckdb/build/release/duckdb -unsigned

Then, load the H3 extension like so:

LOAD 'build/release/h3.duckdb_extension';

Test running an H3 function:

SELECT h3_cell_to_parent(cast(586265647244115967 as ubigint), 1);

Implemented functions

  • h3_latlng_to_cell
  • h3_cell_to_lat
  • h3_cell_to_lng
  • h3_cell_to_latlng
  • h3_cell_to_boundary_wkt
  • h3_get_resolution
  • h3_get_base_cell_number
  • h3_string_to_h3
  • h3_h3_to_string
  • h3_is_valid_cell
  • h3_is_res_class_iii
  • h3_is_pentagon
  • h3_get_icosahedron_faces
  • h3_cell_to_parent
  • h3_cell_to_children
  • h3_cell_to_center_child
  • h3_cell_to_child_pos
  • h3_child_pos_to_cell
  • h3_compact_cells
  • h3_uncompact_cells
  • h3_grid_disk
  • h3_grid_disk_distances
  • h3_grid_disk_unsafe
  • h3_grid_disk_distances_unsafe
  • h3_grid_ring_unsafe
  • h3_grid_path_cells
  • h3_grid_distance
  • h3_cell_to_local_ij
  • h3_local_ij_to_cell
  • h3_cell_to_vertex
  • h3_cell_to_vertexes
  • h3_vertex_to_lat
  • h3_vertex_to_lng
  • h3_vertex_to_latlng
  • h3_is_valid_vertex
  • h3_is_valid_directed_edge
  • h3_origin_to_directed_edges
  • h3_directed_edge_to_cells
  • h3_get_directed_edge_origin
  • h3_get_directed_edge_destination
  • h3_cells_to_directed_edge
  • h3_are_neighbor_cells
  • h3_directed_edge_to_boundary_wkt
  • h3_get_hexagon_area_avg
  • h3_cell_area
  • h3_edge_length
  • h3_get_num_cells
  • h3_get_res0_cells
  • h3_get_pentagons
  • h3_great_circle_distance
  • h3_cells_to_multi_polygon_wkt

Development

The build instructions suggest using ninja because it enables parallelism by default. Using make instead is fine, but you will want to enable the following parallelism option, because building DuckDB can take a very long time (>=1 hour is not unusual). Run the below replacing 4 with the number of CPU cores on your machine.

CMAKE_BUILD_PARALLEL_LEVEL=4 make duckdb_release release

To run tests:

make test

To update the submodules to latest upstream, run:

make update_deps

License

h3-duckdb Copyright 2022 Isaac Brodsky. Licensed under the Apache 2.0 License.

H3 Copyright 2018 Uber Technologies Inc. (Apache 2.0 License)

DGGRID Copyright (c) 2015 Southern Oregon University

DuckDB Copyright 2018-2022 Stichting DuckDB Foundation (MIT License)

Build system adapted from sqlitescanner Copyright 2018-2022 DuckDB Labs BV (MIT License)

About

Bindings for H3 to DuckDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.0%
  • CMake 5.7%
  • Makefile 1.3%