Package: duckspatial 1.1.2

duckspatial: R Interface to 'DuckDB' Database with Spatial Extension

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.

Authors:Adrián Cidre González [aut, cre], Egor Kotov [aut], Rafael H. M. Pereira [aut]

duckspatial_1.1.2.tar.gz
duckspatial_1.1.2.zip(r-4.7)duckspatial_1.1.2.zip(r-4.6)duckspatial_1.1.2.zip(r-4.5)
duckspatial_1.1.2.tgz(r-4.6-any)duckspatial_1.1.2.tgz(r-4.5-any)
duckspatial_1.1.2.tar.gz(r-4.7-any)duckspatial_1.1.2.tar.gz(r-4.6-any)
duckspatial_1.1.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
duckspatial/json (API)

# Install 'duckspatial' in R:
install.packages('duckspatial', repos = c('https://cidree.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/cidree/duckspatial/issues

Pkgdown/docs site:https://cidree.github.io

On CRAN:

Conda:

quarto

11.59 score 111 stars 6 packages 270 scripts 6.7k downloads 133 exports 43 dependencies

Last updated from:46f3fad52e. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK188
source / vignettesOK239
linux-release-x86_64OK196
macos-release-arm64OK170
macos-oldrel-arm64OK160
windows-develOK211
windows-releaseOK162
windows-oldrelOK3086
wasm-releaseOK166

Exports:as_duckspatial_dfddbs_affineddbs_areaddbs_as_geojsonddbs_as_hexwkbddbs_as_pointsddbs_as_textddbs_as_wkbddbs_azimuthddbs_bboxddbs_boundaryddbs_bufferddbs_build_areaddbs_centroidddbs_collectddbs_combineddbs_computeddbs_concave_hullddbs_contains_properlyddbs_convex_hullddbs_covered_byddbs_coversddbs_create_connddbs_create_schemaddbs_cropddbs_crsddbs_differenceddbs_dimensionddbs_disjointddbs_distanceddbs_driversddbs_drop_geometryddbs_dumpddbs_endpointddbs_envelopeddbs_equalsddbs_exterior_ringddbs_filterddbs_flipddbs_flip_coordinatesddbs_force_2dddbs_force_3dddbs_force_4dddbs_generate_pointsddbs_geom_colddbs_geometry_typeddbs_get_ngeometriesddbs_get_npointsddbs_get_resourcesddbs_glimpseddbs_has_mddbs_has_zddbs_installddbs_interpolate_awddbs_intersectionddbs_intersectsddbs_intersects_extentddbs_is_closedddbs_is_emptyddbs_is_ringddbs_is_simpleddbs_is_validddbs_is_within_distanceddbs_joinddbs_lengthddbs_line_endpointddbs_line_interpolateddbs_line_locate_pointddbs_line_mergeddbs_line_startpointddbs_line_substringddbs_list_tablesddbs_loadddbs_locate_alongddbs_locate_betweenddbs_mddbs_make_envelopeddbs_make_lineddbs_make_polygonddbs_make_validddbs_maximum_inscribed_circleddbs_minimum_rotated_rectangleddbs_mmaxddbs_mminddbs_multiddbs_open_datasetddbs_optionsddbs_overlapsddbs_perimeterddbs_pointddbs_polygonizeddbs_predicateddbs_quadkeyddbs_read_metaddbs_read_tableddbs_read_vectorddbs_register_tableddbs_register_vectorddbs_remove_repeated_pointsddbs_rotateddbs_rotate_3dddbs_scaleddbs_set_crsddbs_set_resourcesddbs_shearddbs_shiftddbs_shortest_lineddbs_simplifyddbs_sitrepddbs_startpointddbs_stop_connddbs_sym_differenceddbs_touchesddbs_transformddbs_unionddbs_union_aggddbs_verticesddbs_voronoiddbs_withinddbs_within_properlyddbs_write_datasetddbs_write_tableddbs_write_vectorddbs_xddbs_xmaxddbs_xminddbs_yddbs_ymaxddbs_yminddbs_zddbs_zmaxddbs_zminis_duckspatial_df

Dependencies:arrowassertthatbitbit64blobclassclassIntclicpp11DBIdbplyrdplyrduckdbe1071genericsgeoarrowgluejsonliteKernSmoothlifecyclemagrittrMASSnanoarrowpillarpkgconfigproxypurrrR6Rcpprlangs2sfstringistringrtibbletidyrtidyselectunitsutf8uuidvctrswithrwk

Getting started
Installation | Reading data | Processing data | Working in a database | Creating a connection | Non-persistent database | Persistent database | Reopening saved tables | Technical Note on Interoperability

Last update: 2026-06-01
Started: 2026-02-26

Benchmark
TL;DR | Prepare data | Spatial join | Spatial filter | Spatial distances | Dissolving geometries | Geometry predicates

Last update: 2026-03-28
Started: 2026-02-26

Areal Interpolation
Setup Data | 1) Extensive vs. Intensive Interpolation | Case A: Extensive Variables (Counts) | Case B: Intensive Variables (Densities/Ratios) | Visual Comparison | 2) High Performance: Output as Tibble | 3) Database Mode: Large Data Workflows | Cleanup

Last update: 2026-03-21
Started: 2026-02-26

Spatial joins
1) In-memory: pass sf, return sf | 2) Connected: pass table names in DuckDB, return sf | 3) Write-to-DB: create a new table with the join result | Spatial Join Predicates: | Clean up

Last update: 2026-03-21
Started: 2026-02-26

Readme and manuals

Help Manual

Help pageTopics
Convert objects to duckspatial_dfas_duckspatial_df as_duckspatial_df.character as_duckspatial_df.data.frame as_duckspatial_df.duckspatial_df as_duckspatial_df.sf as_duckspatial_df.tbl_duckdb_connection as_duckspatial_df.tbl_lazy
Convert a duckspatial_df to a nanoarrow_array_streamas_nanoarrow_array_stream.duckspatial_df
Collect a duckspatial_df with flexible output formatscollect.duckspatial_df ddbs_collect
Apply an affine transformation to geometriesddbs_affine
Convert geometries to standard interchange formatsddbs_as_format ddbs_as_geojson ddbs_as_hexwkb ddbs_as_text ddbs_as_wkb
Generate point geometries from coordinatesddbs_as_points
Get the bounding box of geometriesddbs_bbox
Geometry binary operationsddbs_binary_funs ddbs_crop ddbs_difference ddbs_intersection ddbs_shortest_line ddbs_sym_difference
Get the boundary of geometriesddbs_boundary
Creates a buffer around geometriesddbs_buffer
Build polygon areas from multiple linestringsddbs_build_area
Calculates the centroid of geometriesddbs_centroid
Force computation of a lazy duckspatial_dfddbs_compute
Compute the concave hull of geometriesddbs_concave_hull
Compute the convex hull of geometriesddbs_convex_hull
Coordinate bounds of geometriesddbs_coord_bounds ddbs_mmax ddbs_mmin ddbs_xmax ddbs_xmin ddbs_ymax ddbs_ymin ddbs_zmax ddbs_zmin
Create a DuckDB connection with spatial extensionddbs_create_conn
Check and create schemaddbs_create_schema
Check CRS of spatial objects or database tablesddbs_crs ddbs_crs.character ddbs_crs.crs ddbs_crs.data.frame ddbs_crs.default ddbs_crs.duckdb_connection ddbs_crs.duckspatial_df ddbs_crs.numeric ddbs_crs.sf ddbs_crs.tbl_duckdb_connection
Get the topological dimension of a geometryddbs_dimension
Get list of GDAL drivers and file formatsddbs_drivers
Drop geometry column from a duckspatial_df objectddbs_drop_geometry
Dumps geometries into their component partsddbs_dump
Extract the start or end point of a linestring geometryddbs_endpoint_startpoint ddbs_line_endpoint ddbs_line_startpoint
Get the envelope (bounding box) of geometriesddbs_envelope
Extract the exterior ring of polygonsddbs_exterior_ring
Perform a spatial filterddbs_filter
Flip geometries horizontally or verticallyddbs_flip
Flips the X and Y coordinates of geometriesddbs_flip_coordinates
Force geometry dimensionsddbs_force_2d ddbs_force_3d ddbs_force_4d ddbs_force_dim
Generate random points within bounding boxes of geometriesddbs_generate_points
Get the geometry column nameddbs_geom_col
Geometry validation functionsddbs_geom_validation_funs ddbs_is_closed ddbs_is_empty ddbs_is_ring ddbs_is_simple ddbs_is_valid
Get the geometry type of featuresddbs_geometry_type
Count geometry componentsddbs_get_ngeometries ddbs_get_npoints
Check first rows of the dataddbs_glimpse
Check geometry dimensionsddbs_has_dim ddbs_has_m ddbs_has_z
Checks and installs the Spatial extensionddbs_install
Areal-Weighted Interpolation using DuckDBddbs_interpolate_aw
Perform a spatial join of two geometriesddbs_join
Interpolates a point or points along a line geometryddbs_line_interpolate
Locate a point along a linestringddbs_line_locate_point
Merge line geometries into a single lineddbs_line_merge
Extract a substring of a line geometryddbs_line_substring
Check tables and schemas inside a databaseddbs_list_tables
Loads the Spatial extensionddbs_load
Locate geometries at specific M valuesddbs_locate ddbs_locate_along ddbs_locate_between
Create a rectangular polygon from bounding coordinatesddbs_make_envelope
Create lines from point geometriesddbs_make_line
Create a polygon from a single closed linestringddbs_make_polygon
Make invalid geometries validddbs_make_valid
Computes the maximum inscribed circle of a geometryddbs_maximum_inscribed_circle
Calculate geometric measurementsddbs_area ddbs_azimuth ddbs_distance ddbs_length ddbs_measure_funs ddbs_perimeter
Computes the minimum rotated rectangle enclosing a geometryddbs_minimum_rotated_rectangle
Convert geometries to multi-typeddbs_multi
Open spatial dataset lazily via DuckDBddbs_open_dataset
Get or set global duckspatial optionsddbs_options
Create point geometries from coordinate vectorsddbs_point
Assemble polygons from multiple linestringsddbs_polygonize
Evaluate spatial predicates between geometriesddbs_contains ddbs_contains_properly ddbs_covered_by ddbs_covers ddbs_crosses ddbs_disjoint ddbs_equals ddbs_intersects ddbs_intersects_extent ddbs_is_within_distance ddbs_overlaps ddbs_predicate ddbs_touches ddbs_within ddbs_within_properly
Convert point geometries to QuadKey tilesddbs_quadkey
Read metadata from a spatial fileddbs_read_meta
Reads a vectorial table from DuckDB into Rddbs_read_table
Register an SF Object as an Arrow Table in DuckDBddbs_register_table
Remove repeated points from a geometryddbs_remove_repeated_points
Rotate geometries around their centroidddbs_rotate
Rotate 3D geometries around an axisddbs_rotate_3d
Scale geometries by X and Y factorsddbs_scale
Set the coordinate reference system of geometriesddbs_set_crs
Get or set connection resourcesddbs_get_resources ddbs_set_resources
Shear geometriesddbs_shear
Shift geometries by X and Y offsetsddbs_shift
Simplify geometriesddbs_simplify
Report duckspatial configuration statusddbs_sitrep
Close a DuckDB connectionddbs_stop_conn
Transform the coordinate reference system of geometriesddbs_transform
Union and combine geometriesddbs_combine ddbs_union ddbs_union_agg ddbs_union_funs
Collect all vertices of a geometry into a MULTIPOINTddbs_vertices
Computes a Voronoi diagram from point geometriesddbs_voronoi
Write spatial dataset to diskddbs_write_dataset
Write an SF Object to a DuckDB Databaseddbs_write_table
Extract coordinates from geometriesddbs_m ddbs_x ddbs_xy ddbs_y ddbs_z
Check if object is a duckspatial_dfis_duckspatial_df