You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by pa...@apache.org on 2026/08/11 12:13:08 UTC
(sedona-db) branch main updated: docs(r/sdplyr): Add README for the sdplyr package (#1147)
This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git
The following commit(s) were added to refs/heads/main by this push:
new 0fc124a25 docs(r/sdplyr): Add README for the sdplyr package (#1147)
0fc124a25 is described below
commit 0fc124a2542f6483da93e4b7b6d440351453200f
Author: Hiroaki Yutani <yu...@gmail.com>
AuthorDate: Tue Aug 11 21:13:03 2026 +0900
docs(r/sdplyr): Add README for the sdplyr package (#1147)
---
r/sdplyr/README.Rmd | 98 ++++++++++++++++++++++++++++++++++++++
r/sdplyr/README.md | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 230 insertions(+)
diff --git a/r/sdplyr/README.Rmd b/r/sdplyr/README.Rmd
new file mode 100644
index 000000000..8c510647b
--- /dev/null
+++ b/r/sdplyr/README.Rmd
@@ -0,0 +1,98 @@
+---
+output: github_document
+---
+
+<!---
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>",
+ fig.path = "man/figures/README-",
+ out.width = "100%"
+)
+```
+
+# sdplyr
+
+<!-- badges: start -->
+[](https://apache.r-universe.dev/sdplyr)
+<!-- badges: end -->
+
+The goal of sdplyr is to provide a [dplyr](https://dplyr.tidyverse.org/) interface to [Apache SedonaDB](https://sedona.apache.org/sedonadb). It lets you use familiar dplyr verbs and the spatial functions documented by sedonafns with SedonaDB-backed lazy data frames.
+
+## Installation
+
+sdplyr can be installed from [R-multiverse](https://community.r-multiverse.org/):
+
+``` r
+install.packages(
+ "sdplyr",
+ repos = c("https://community.r-multiverse.org", "https://cloud.r-project.org")
+)
+```
+
+You can install the development version of sdplyr from [GitHub](https://github.com/) with:
+
+``` r
+pak::pkg_install("apache/sedona-db/r/sdplyr")
+```
+
+Installing a development version of sdplyr requires a [Rust compiler](https://rustup.rs) and a GEOS system dependency (e.g., `brew install geos` or `apt-get install libgeos-dev`). Install instructions for these dependencies on other platforms can be found on the [sf package homepage](https://r-spatial.github.io/sf).
+
+## Example
+
+Read GeoParquet files into lazy SedonaDB data frames and use dplyr verbs to perform a spatial join:
+
+```{r example}
+library(sdplyr)
+
+cities_url <- "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_cities.parquet"
+countries_url <- "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_countries.parquet"
+
+cities <- sd_read_parquet(cities_url)
+countries <- sd_read_parquet(countries_url)
+
+cities |>
+ inner_join(
+ countries,
+ by = sd_join_intersects()
+ ) |>
+ filter(continent != "North America") |>
+ select(
+ city = name.x,
+ country = name.y,
+ continent
+ ) |>
+ arrange(country) |>
+ head(10)
+```
+
+Spatial predicates can also compare a geometry column with an R spatial object. For example, this query finds cities inside a longitude-latitude bounding box:
+
+```{r}
+cities |>
+ filter(
+ sd_intersects(
+ geometry,
+ wk::rct(-80, 40, -60, 60, wk::wk_crs_longlat())
+ )
+ )
+```
diff --git a/r/sdplyr/README.md b/r/sdplyr/README.md
new file mode 100644
index 000000000..0509e6137
--- /dev/null
+++ b/r/sdplyr/README.md
@@ -0,0 +1,132 @@
+
+<!---
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+# sdplyr
+
+<!-- badges: start -->
+
+[](https://apache.r-universe.dev/sdplyr)
+<!-- badges: end -->
+
+The goal of sdplyr is to provide a [dplyr](https://dplyr.tidyverse.org/)
+interface to [Apache SedonaDB](https://sedona.apache.org/sedonadb). It
+lets you use familiar dplyr verbs and the spatial functions documented
+by sedonafns with SedonaDB-backed lazy data frames.
+
+## Installation
+
+sdplyr can be installed from
+[R-multiverse](https://community.r-multiverse.org/):
+
+``` r
+install.packages(
+ "sdplyr",
+ repos = c("https://community.r-multiverse.org", "https://cloud.r-project.org")
+)
+```
+
+You can install the development version of sdplyr from
+[GitHub](https://github.com/) with:
+
+``` r
+pak::pkg_install("apache/sedona-db/r/sdplyr")
+```
+
+Installing a development version of sdplyr requires a [Rust
+compiler](https://rustup.rs) and a GEOS system dependency (e.g.,
+`brew install geos` or `apt-get install libgeos-dev`). Install
+instructions for these dependencies on other platforms can be found on
+the [sf package homepage](https://r-spatial.github.io/sf).
+
+## Example
+
+Read GeoParquet files into lazy SedonaDB data frames and use dplyr verbs
+to perform a spatial join:
+
+``` r
+library(sdplyr)
+#> ── Attaching sdplyr packages ───────────────────────────────────────────────────────────────────────── 0.4.0.9000 ──
+#> ✔ sedonadb 0.4.0.9000
+#> ✔ sedonafns 0.4.0.9000
+#> ✔ dplyr 1.2.0
+
+cities_url <- "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_cities.parquet"
+countries_url <- "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_countries.parquet"
+
+cities <- sd_read_parquet(cities_url)
+countries <- sd_read_parquet(countries_url)
+
+cities |>
+ inner_join(
+ countries,
+ by = sd_join_intersects()
+ ) |>
+ filter(continent != "North America") |>
+ select(
+ city = name.x,
+ country = name.y,
+ continent
+ ) |>
+ arrange(country) |>
+ head(10)
+#> <sedonab_dataframe: NA x 3>
+#> ┌──────────────┬─────────────┬───────────────┐
+#> │ city ┆ country ┆ continent │
+#> │ utf8 ┆ utf8 ┆ utf8 │
+#> ╞══════════════╪═════════════╪═══════════════╡
+#> │ Kabul ┆ Afghanistan ┆ Asia │
+#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Tirana ┆ Albania ┆ Europe │
+#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Algiers ┆ Algeria ┆ Africa │
+#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Luanda ┆ Angola ┆ Africa │
+#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Buenos Aires ┆ Argentina ┆ South America │
+#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Yerevan ┆ Armenia ┆ Asia │
+#> └──────────────┴─────────────┴───────────────┘
+#> Preview of up to 6 row(s)
+```
+
+Spatial predicates can also compare a geometry column with an R spatial
+object. For example, this query finds cities inside a longitude-latitude
+bounding box:
+
+``` r
+cities |>
+ filter(
+ sd_intersects(
+ geometry,
+ wk::rct(-80, 40, -60, 60, wk::wk_crs_longlat())
+ )
+ )
+#> <sedonab_dataframe: NA x 2>
+#> ┌──────────┬─────────────────────────────────────────────┐
+#> │ name ┆ geometry │
+#> │ utf8 ┆ geometry │
+#> ╞══════════╪═════════════════════════════════════════════╡
+#> │ Ottawa ┆ POINT(-75.7019612 45.4186427) │
+#> ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ Toronto ┆ POINT(-79.38945855491194 43.66464454743429) │
+#> ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+#> │ New York ┆ POINT(-73.99571754361698 40.72156174972766) │
+#> └──────────┴─────────────────────────────────────────────┘
+#> Preview of up to 6 row(s)
+```