Skip to content

dbSpatial

Spatial Data Operations for Database-Backed Geometries

v0.1.2 · Jun 23, 2026 · GPL-3 | MIT + file LICENSE

Description

Provides database-backed spatial geometry classes and methods for working with vector spatial data in 'DuckDB'. The package supports loading, converting, querying, joining, and measuring spatial geometries through familiar 'sf'-style interfaces while keeping geometry columns lazy inside the database. It integrates with 'dbProject' to preserve database paths, live connections, and spatial table metadata across interactive sessions. The package follows the Simple Features framework described by Pebesma (2018) <doi:10.32614/RJ-2018-009> and uses DuckDB's spatial extension <https://duckdb.org/docs/stable/core_extensions/spatial/overview.html>.

Downloads

CRAN

523

Last 30 days

6939th

612

Last 90 days

612

Last year

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

autoCRAN

4

Last 7 days

9

Last 30 days

0

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

2 ERROR
11 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang ERROR
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-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
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-debian-clang

re-building of vignette outputs

Error(s) in re-building vignettes:
  ...
--- re-building ‘class_structure.Rmd’ using rmarkdown

Quitting from class_structure.Rmd:32-52 [unnamed-chunk-2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `dbSendQuery()`:
! Invalid Error: IO Error: Cannot open file "/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/duckdb/extensions/v1.5.4/linux_amd64/spatial.duckdb_extension.tmp-989860c0-6cc3-41ea-822f-810e485a62d1.duckdb_extension": Read-only file system
ℹ Context: rapi_prepare
ℹ Error type: INVALID
---
Backtrace:
     ▆
  1. └─dbSpatial::dbSpatial(...)
  2.   ├─base::suppressMessages(loadSpatial(conn = conn))
  3.   │ └─base::withCallingHandlers(...)
  4.   └─dbSpatial::loadSpatial(conn = conn)
  5.     ├─DBI::dbExecute(conn, query)
  6.     └─DBI::dbExecute(conn, query)
  7.       ├─DBI::dbSendStatement(conn, statement, ...)
  8.       └─DBI::dbSendStatement(conn, statement, ...)
  9.         ├─DBI::dbSendQuery(con
...[truncated]...
::loadSpatial(conn = conn)
  5.     ├─DBI::dbExecute(conn, query)
  6.     └─DBI::dbExecute(conn, query)
  7.       ├─DBI::dbSendStatement(conn, statement, ...)
  8.       └─DBI::dbSendStatement(conn, statement, ...)
  9.         ├─DBI::dbSendQuery(conn, statement, ...)
 10.         └─duckdb::dbSendQuery(conn, statement, ...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'spatial_operations.Rmd' failed with diagnostics:
Invalid Error: IO Error: Cannot open file "/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/duckdb/extensions/v1.5.4/linux_amd64/spatial.duckdb_extension.tmp-5a0e0350-48fa-42da-b214-a39158d0aaa9.duckdb_extension": Read-only file system
ℹ Context: rapi_prepare
ℹ Error type: INVALID
--- failed re-building ‘spatial_operations.Rmd’

SUMMARY: processing the following files failed:
  ‘class_structure.Rmd’ ‘getting_started.Rmd’ ‘spatial_operations.Rmd’

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

tests

Running ‘testthat.R’ [25s/29s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(dbSpatial)
  > 
  > test_check("dbSpatial")
  Saving _problems/test-extract-15.R
  Saving _problems/test-spatial-functions-15.R
  Saving _problems/test-spatial-functions-35.R
  Saving _problems/test-spatial-functions-70.R
  Saving _problems/test-spatial-functions-95.R
  Saving _problems/test-spatial-functions-117.R
  [ FAIL 6 | WARN 0 | SKIP 0 | PASS 0 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-extract.R:8:3'): $ extracts column values ──────────────────────
  Error in `dbSendQuery(conn, statement, ...)`: Invalid Error: IO Error: Cannot open file "/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/duckdb/extensions/v1.5.4/linux_amd64/spatial.duckdb_extension.tmp-5ecceff8-23c0-44b8-9370-c5df2a4d3005.duckdb_extension": Read-only file system
  i Context: rapi_prepare
  i Error type: INVALID

...[truncated]...
rethrow_rapi_prepare(conn@conn_ref, statement, env)
   13. │             ├─rlang::try_fetch(...)
   14. │             │ ├─base::tryCatch(...)
   15. │             │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   16. │             │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   17. │             │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   18. │             │ └─base::withCallingHandlers(...)
   19. │             └─duckdb:::rapi_prepare(conn, query, env)
   20. ├─duckdb (local) `<fn>`(...)
   21. │ └─rlang::abort(error_parts, class = "duckdb_error", !!!fields)
   22. │   └─rlang:::signal_abort(cnd, .file)
   23. │     └─base::signalCondition(cnd)
   24. └─rlang (local) `<fn>`(`<dckdb_rr>`)
   25.   └─handlers[[1L]](cnd)
   26.     └─duckdb:::rethrow_error_from_rapi(e, call)
   27.       └─rlang::abort(msg, call = call)
  
  [ FAIL 6 | WARN 0 | SKIP 0 | PASS 0 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-devel-linux-x86_64-fedora-clang

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘class_structure.Rmd’ using rmarkdown

Quitting from class_structure.Rmd:34-54 [unnamed-chunk-2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `duckdb_result()`:
! Invalid Error: Invalid Input Error: Initialization function "spatial_duckdb_cpp_init" from file "/tmp/Rtmp4DryzD/working_dir/RtmpTbvzam/dbSpatial-duckdb-extensions/v1.5.4/linux_amd64/spatial.duckdb_extension" threw an exception: "Missing DB manager"
ℹ Context: rapi_execute
ℹ Error type: INVALID
---
Backtrace:
     ▆
  1. └─dbSpatial::dbSpatial(...)
  2.   ├─base::suppressMessages(loadSpatial(conn = conn))
  3.   │ └─base::withCallingHandlers(...)
  4.   └─dbSpatial::loadSpatial(conn = conn)
  5.     ├─DBI::dbExecute(conn, "LOAD spatial")
  6.     └─DBI::dbExecute(conn, "LOAD spatial")
  7.       ├─DBI::dbSendStatement(conn, statement, ...)
  8.       └─DBI::dbSendStatement(conn, statement, ...)
  9.         ├─DB
...[truncated]...
eave(file, quiet = quiet, encoding = enc)    setwd(startdir)    output <- find_vignette_product(name, by = "weave", engine = engine)    if (!have.makefile && vignette_is_tex(output)) {        texi2pdf(file = output, clean = FALSE, quiet = quiet)        output <- find_vignette_product(name, by = "texi2pdf",             engine = engine)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)), domain = NA)})
56: tools:::.buildOneVignette("spatial_operations.Rmd", "/data/gannet/ripley/R/packages/tests-clang/dbSpatial.Rcheck/vign_test/dbSpatial",     TRUE, FALSE, "spatial_operations", "UTF-8", "/tmp/Rtmp4DryzD/working_dir/RtmprEHBoE/file329be76ceb0fdb.rds")
An irrecoverable exception occurred. R is aborting now ...
SUMMARY: processing the following files failed:
  ‘class_structure.Rmd’ ‘getting_started.Rmd’ ‘spatial_operations.Rmd’

Error: Vignette re-building failed.
Execution halted

Check History

ERROR 6 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE May 28, 2026
ERROR r-devel-linux-x86_64-fedora-clang

tests

Running ‘testthat.R’ [30s/114s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(dbSpatial)
  > 
  > test_check("dbSpatial")
  Saving _problems/test-extract-15.R
  Saving _problems/test-spatial-functi
...[truncated]...
= load_package, parallel = parallel, shuffle = shuffle)
  55: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  56: test_check("dbSpatial")
  An irrecoverable exception occurred. R is aborting now ...

Dependency Network

Dependencies Reverse dependencies DBI duckdb dplyr dbplyr terra sf e1071 lifecycle crayon checkmate cli rlang glue tidyselect dbProject dbSpatial

Version History

2 tracked
updated 0.1.2 ← 0.1.1 diff Jun 23, 2026
new 0.1.1 May 27, 2026