Skip to content

duckspatial

R Interface to 'DuckDB' Database with Spatial Extension

v1.0.0 · Mar 30, 2026 · GPL (>= 3)

Description

Fast & memory-efficient functions to analyze and manipulate large spatial data data sets. It leverages the fast analytical capabilities of 'DuckDB' and its spatial extension (see <https://duckdb.org/docs/stable/core_extensions/spatial/overview>) while maintaining compatibility with R’s spatial data ecosystem to work with spatial vector data.

Downloads

520

Last 30 days

7675th

1.4K

Last 90 days

3.6K

Last year

Trend: +20.1% (30d vs prior 30d)

CRAN Check Status

2 ERROR
12 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang ERROR
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 ERROR
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (3 non-OK)
ERROR r-devel-linux-x86_64-fedora-clang

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘aw_interpolation.qmd’ using html
[31m

processing file: aw_interpolation.qmd
[39m[31mError in `duckdb_result()`:
! Invalid Error: Invalid Input Error: Initialization function "spatial_duckdb_cpp_init" from file "/data/gannet/ripley/.local/share/R/duckdb/extensions/v1.5.1/linux_amd64/spatial.duckdb_extension" threw an exception: "Missing DB manager"
ℹ Context: rapi_execute
ℹ Error type: INVALID
Backtrace:
     ▆
  1. ├─duckspatial::ddbs_interpolate_aw(...)
  2. │ └─duckspatial:::resolve_spatial_connections(...)
  3. │   └─duckspatial:::ddbs_default_conn()
  4. │     └─duckspatial::ddbs_create_conn(dbdir = "memory", ...)
  5. │       └─duckspatial::ddbs_load(conn, quiet = TRUE)
  6. │         ├─base::suppressMessages(DBI::dbExecute(conn, glue::glue("LOAD {extension};")))
  7. │         │ └─base::withCallingHandlers(...)
  8. │         ├─DBI::dbExecute(conn, glue::glue("LOAD {extension};"))
  9. │         └─DBI::dbExecute(conn, glue::
...[truncated]...
 output_format = output_format,     knit_root_dir = knit_root_dir, params = params, run_pandoc = FALSE,     envir = env)
53: execute(params$input, params$format, params$tempDir, params$libDir,     params$dependencies, params$cwd, params$params, params$resourceDir,     params$handledLanguages, params$markdown)
54: .main()
An irrecoverable exception occurred. R is aborting now ...
[39m[33mWARN: Error encountered when rendering files[39m
Error: processing vignette 'spatial_joins.qmd' failed with diagnostics:
! Error running quarto CLI from R.
Caused by error:
! Could not parse cli `{}` expression: ` { .__han…`.
Caused by error:
! <text>:1:49: unexpected symbol
1:     {        .__handler_frame__. <- TRUE        .__setup_frame__.
                                                    ^
--- failed re-building ‘spatial_joins.qmd’

SUMMARY: processing the following files failed:
  ‘aw_interpolation.qmd’ ‘duckspatial.qmd’ ‘spatial_joins.qmd’

Error: Vignette re-building failed.
Execution halted
ERROR r-devel-linux-x86_64-fedora-clang

tests

Running ‘testthat.R’ [7s/23s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(duckspatial)
  duckspatial 1.0.0 attached
  * Compatible with DuckDB v1.5.1
  * This release introduces breaking changes
  * See full release notes for migration guidance
  
  Default output has changed:
    duckspatial now returns lazy `duckspatial_df` (dbplyr) objects
    instead of `sf` objects.
  
  To restore the previous behaviour:
    ddbs_options(duckspatial.mode = 'sf')
  > library(duckdb)
  Loading required package: DBI
  > 
  > test_check("duckspatial")
  Reading layer `countries' from d
...[truncated]...
                           │ ├─base::tryCatch(...)
   33. │                                             │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   34. │                                             │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   35. │                                             │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   36. │                                             │ └─base::withCallingHandlers(...)
   37. │                                             └─duckdb:::rapi_execute(stmt, convert_opts)
   38. ├─duckdb (local) `<fn>`(...)
   39. │ └─rlang::abort(error_parts, class = "duckdb_error", !!!fields)
   40. │   └─rlang:::signal_abort(cnd, .file)
   41. │     └─base::signalCondition(cnd)
   42. └─rlang (local) `<fn>`(`<dckdb_rr>`)
   43.   └─handlers[[1L]](cnd)
   44.     └─duckdb:::rethrow_error_from_rapi(e, call)
   45.       └─rlang::abort(msg, call = call)
  Execution halted
ERROR r-oldrel-windows-x86_64

tests

Running 'testthat.R' [9s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(duckspatial)
  Important: 'crs_column' and 'crs' arguments are deprecated and will be removed in the next version.
  If possible, use the default values of these arguments to avoid future issues.
  > library(duckdb)
  Loading required package: DBI
  > 
  > test_check("duckspatial")
  Reading layer `countries' from data source 
    `D:\RCompile\CRANpkg\lib\4.4\duckspatial\spatial\countries.geojson' 
    using driver `GeoJSON'
  Simple feature collection with 257 features and 6 fields
  Geometry type: PO
...[truncated]...
_bbox.R:3:1',
    'test-ddbs_combine.R:3:1', 'test-ddbs_concave_hull.R:3:1',
    'test-ddbs_convex_hull.R:3:1', 'test-ddbs_distance.R:3:1',
    'test-ddbs_envelope.R:3:1', 'test-ddbs_generate_points.R:5:1',
    'test-ddbs_interpolate_aw.R:2:1', 'test-ddbs_join.R:3:1',
    'test-ddbs_length.R:3:1', 'test-ddbs_transform.R:5:1',
    'test-ddbs_union.R:3:1', 'test-utils.R:2:1'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-compatibility.R:112:5'): Compatibility: Writing from file path and reading back ──
  Error in `ddbs_read_vector(conn, table_name)`: Geometry column wasn't found in table <countries_from_file_compat>.
  Backtrace:
      ▆
   1. └─duckspatial::ddbs_read_vector(conn, table_name) at test-compatibility.R:112:5
   2.   └─cli::cli_abort("Geometry column wasn't found in table <{name_list$query_name}>.")
   3.     └─rlang::abort(...)
  
  [ FAIL 1 | WARN 2 | SKIP 17 | PASS 31 ]
  Error:
  ! Test failures.
  Execution halted

Check History

ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 10, 2026
ERROR r-devel-linux-x86_64-fedora-clang

tests

Running ‘testthat.R’ [10s/25s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional 
...[truncated]...
load_package, parallel = parallel, shuffle = shuffle)
  55: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  56: test_check("duckspatial")
  An irrecoverable exception occurred. R is aborting now ...

Reverse Dependencies (1)

imports

Dependency Network

Dependencies Reverse dependencies arrow cli DBI dbplyr dplyr duckdb geoarrow glue lifecycle nanoarrow rlang sf tibble units uuid +2 more dependencies cnefetools duckspatial

Version History

updated 1.0.0 ← 0.9.0 diff Mar 30, 2026
new 0.9.0 Mar 10, 2026
updated 0.9.0 ← 0.2.0 diff Jan 9, 2026
updated 0.2.0 ← 0.1.0 diff Apr 28, 2025
new 0.1.0 Apr 18, 2025