Skip to contents

duckh3 0.3.0

BREAKING CHANGES

BUG FIXES

  • ddbh3_default_conn() no longer reuses a default connection created by duckspatial with bigint = "numeric", which silently rounded UBIGINT H3 indexes. It now warns and replaces it with an integer64 connection.
  • Column-name arguments (new_column, h3, h3vertex, lon, lat) and the geometry column name are now quoted as SQL identifiers, so names with spaces or quotes work and SQL expressions passed as column names are no longer executed.
  • When the input already has a column named like new_column, the result now replaces that column. Before, the result was added as <new_column>_1 and the original column kept its old values.
  • Writing the result to the input table itself (name equal to the source table and overwrite = TRUE) no longer deletes the source table: the result is now built in a staging table and swapped in place.
  • ddbh3_create_conn() now registers the ddbh3_* macros, so they work inside dplyr::mutate() on user-created connections.
  • ddbh3_default_conn(create = FALSE) no longer errors when no default connection exists.
  • ddbh3_vertex_to_lon(), ddbh3_vertex_to_lat() and ddbh3_is_vertex() no longer reject valid H3 vertexes in vectorized mode, and ddbh3_is_vertex() returns FALSE for invalid input instead of erroring.
  • ddbh3_create_conn() and ddbh3_default_conn() set geometry_always_xy = true, which DuckDB >= 2.0 requires before spheroid functions such as duckspatial::ddbs_area() can run on H3 geometries. This keeps the pre-2.0 axis convention that duckspatial’s measure functions are written for.
  • ddbh3_child_pos_to_cell() no longer errors when the child position column is stored as a double (e.g. data.frame(h3child_pos = 0)).
  • Writing to a schema-qualified table with overwrite = TRUE (e.g. name = "my_schema.my_table") no longer moves the table to the main schema (#25).
  • Functions no longer fail when they are called before ddbh3_default_conn(): the default connection is now set up with the h3 extension (and bigint = "integer64") when needed, in vectorized and table modes (#26).
  • ddbh3_get_base_cell_number(), ddbh3_grid_disk(), ddbh3_grid_disk_distances(), ddbh3_grid_ring(), ddbh3_grid_path_cells() and ddbh3_grid_distance() now quote column names, so names with spaces or quotes work (#27).
  • ddbh3_grid_disk_distances() now returns all the cells within distance k (it only returned the cells at distance 1), also in vectorized mode (#28).
  • ddbh3_h3_to_spatial() and ddbh3_h3_to_points() now accept a bit64::integer64 vector of cells in vectorized mode (#31).
  • The hexagons created by ddbh3_h3_to_spatial(), ddbh3_lonlat_to_spatial() and ddbh3_h3_to_points() are always stored with the EPSG:4326 CRS. Before, a spatial input in another CRS gave its CRS to the new geometries when writing a table with name (#31).
  • ddbh3_vertex_to_spatial() on a nested vertex column now builds the MULTIPOINT geometries in a single query. It now works with name, and with spatial inputs whatever their geometry column is called (#32).
  • ddbh3_edge_to_spatial() and ddbh3_vertex_to_spatial() now detect nested columns in table names and lazy tables (#32).
  • ddbh3_grid_path_cells(), ddbh3_grid_distance() and ddbh3_child_pos_to_cell() give an informative error when x is a vector (they need a table with two columns) instead of an obscure SQL error (#30).
  • Better argument validation: k must be between 0 and 1500, buffer_scale must be a positive number, h3_format must be a single string, and inputs without a CRS give the “CRS must be EPSG:4326” error (#33).
  • ddbh3_compact() errors when new_column is one of the by columns (#33).
  • ddbh3_default_conn() now applies threads and memory_limit_gb to an existing default connection, instead of silently ignoring them (#33).
  • Vectorized mode no longer warns about invalid elements when the input has NAs (#33).
  • ddbh3_create_conn() warns when bigint is not "integer64", since H3 indexes stored as UBIGINT are then rounded (#33).
  • mode is now validated: values other than "duckspatial" or "sf" give an error, instead of silently returning a duckspatial_df (#36, reported upstream as Cidree/duckspatial#197).
  • In vectorized mode, results that are NA for valid cells (e.g. ddbh3_get_parent() to a finer resolution) now warn that the other arguments may be incompatible with the input, instead of saying that x is invalid. Empty list results (e.g. ddbh3_get_children() to a coarser resolution) now warn too (#37).
  • ddbh3_compact() and ddbh3_uncompact() return a zero-length vector for a zero-length input (they returned NULL), and validate and compute in a single query in vectorized mode (#37).
  • ddbh3_default_conn(bigint = ...) warns that bigint is ignored, instead of failing with formal argument "bigint" matched by multiple actual arguments (#38).
  • Vectorized mode accepts factors and all-NA logical vectors (e.g. NA), and other logical vectors give an informative error. Before, factors were taken as table names (#38).
  • ddbh3_h3_to_vertexes() now works inside dplyr::mutate() (#39).

DOCUMENTATION

  • The examples no longer say that ddbh3_default_conn() is mandatory: it is created when needed since #26 (#42).
  • Documented that nested is ignored in vectorized mode, that ddbh3_polygons_to_spatial() and ddbh3_lines_to_spatial() drop features without cells, that resolution must be compatible with the input cells in hierarchy functions, and that replacing a bigint = "numeric" default connection leaves the old one open (#42).

ENHANCEMENTS

  • Remove arrow lambda syntax for compatibility with DuckDB v2.0 (#6).

  • The @returns documentation now states that spatial outputs are returned as sf with mode = "sf", that *_to_spatial() functions and ddbh3_h3_to_points() always return spatial output, and that mode is ignored for non-spatial results (#10).

  • Internal helpers now reuse those of duckspatial (e.g. identifier quoting with sql_ident(), table names with sql_table(), and extension checks), so both packages handle names and connections the same way. Two related problems were reported upstream: Cidree/duckspatial#195 (schema-qualified table names as input) and Cidree/duckspatial#196 (length-2 name).

  • Vectorized mode is up to ~40x faster: input validation and evaluation now run in a single query, and the default connection is no longer re-initialised on every call. The h3 extension check is cached for the default connection.

  • Faster polygon/line to H3 conversion: polyfill reads WKB instead of WKT, the geometry type is validated on the already-prepared input instead of preparing it twice, and the cell list is no longer de-duplicated twice.

  • Internal clean-up: the input preparation shared by every function is now a single helper (ddbh3_points_to_*() use the templates too), and SQL string literals are always quoted with the duckspatial helper (#43).

NEW FEATURES

duckh3 0.2.0

CRAN release: 2026-10-11

BUILD

  • Requires DuckDB >= 1.5.6

  • Requires duckspatial >= 1.3.0

ENHANCEMENTS

  • Functions in vectorized mode automatically parse to UBIGINT when the input is a numeric vector.

  • Error message on wrong CRS is now displayed correctly (#3).

NEW FEATURES

  • New functions to convert polygon and linestring geometries to H3 cells (#2):
    • ddbh3_polygons_to_h3() / ddbh3_lines_to_h3() add a list column with the H3 cells intersecting each feature (string or UBIGINT).
    • ddbh3_polygons_to_spatial() / ddbh3_lines_to_spatial() return one row per intersecting cell, with geometry replaced by the cell hexagon boundary.
    • Polygons use DuckDB’s experimental polygon polyfill (overlap containment by default); lines are polyfilled via a buffer-then-exact-trim strategy since they have no native polyfill (buffer_scale argument).

duckh3 0.1.0

CRAN release: 2026-04-24

Learn more about this release here.

  • Initial CRAN submission.