-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
59 lines (43 loc) · 2 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# dbSpatial
<!-- badges: start -->
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://CRAN.R-project.org/package=dbSpatial)
<!-- badges: end -->
`{dbSpatial}` is a core package in the [`dbverse`](https://drieslab.github.io/dbverse/) library.
The goal of `{dbSpatial}` is to provide larger-than-memory spatial operations for various spatial data sources. The package largely relies on the
[DuckDB spatial extension](https://duckdb.org/docs/extensions/spatial.html).
**Note: Work in progress! Bugs or unexpected behavior are likely to occur. We welcome user feedback and reporting issues on the [Github page ](https://github.com/drieslab/dbSpatial/).**
## Installation
You can install the development version of dbSpatial from Github like so:
```{r, eval = FALSE}
# install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
pak::pak("drieslab/dbSpatial")
```
## Usage
The DuckDB spatial extension can be used with wrapper functions in this package directly (`ST_*()`), through dplyr verbs containing `ST_*()` functions, or SQL queries to a DuckDB database connection containing `ST_*()` functions.
```{r}
library(dbSpatial)
# create duckdb db in memory
duckdb_conn = DBI::dbConnect(duckdb::duckdb(), ":memory:")
# test data
test_data = data.frame(x = 1:10, y = 1:10, id = 1:10)
points <- dbSpatial(conn = duckdb_conn,
name = "test_points",
value = test_data,
x_colName = "x",
y_colName = "y",
overwrite = TRUE)
points
```