load_h3: load the duckdb geospatial data plugin

View source: R/h3.R

load_h3R Documentation

load the duckdb geospatial data plugin

Description

load the duckdb geospatial data plugin

Usage

load_h3(conn = cached_connection())

Arguments

conn

A database connection object created using the cache_connection function (default: cache_connection()).

Value

loads the extension and returns status invisibly.

References

https://github.com/isaacbrodsky/h3-duckdb

Examples



library(dplyr)
load_h3()
ex <- system.file("extdata/spatial-test.csv", package="duckdbfs")

zoom <- 9L # Zoom must be explicit integer, L
query <- ex |>
  open_dataset(format = "csv") |>
  mutate(h3id = h3_latlng_to_cell_string(latitude, longitude, zoom))

 # as data.frame
 collect(query)

 # write to a file
 path <- tempfile(fileext = ".h3j")
 query |> to_h3j(path)


duckdbfs documentation built on April 11, 2025, 5:52 p.m.