sd_join_by.RdUse sd_join_by() to specify join conditions for sd_join() using
expressions that reference columns from both tables. Table references
are specified using x$column and y$column syntax to disambiguate
columns from the left and right tables, and the special helper x$geom()
and y$geom() may be used for tables with exactly one geometry column.
Spatial joins can use spatial predicates in the join by expression
(e.g., sd_join_by(st_intersects(x$geom(), y$geom()))) or the shorthand
sd_join_intersects().
sd_join_by(...)
sd_join_intersects()
sd_join_contains()
sd_join_within()
sd_join_covers()
sd_join_coveredby()
sd_join_touches()
sd_join_crosses()
sd_join_overlaps()
sd_join_equals()
sd_join_dwithin(distance)Expressions specifying join conditions. These should be
comparison expressions (e.g., x$id == y$id, x$value > y$threshold)
or spatial predicate expressions
(e.g., st_intersects(x$geometry, y$geometry)).
Multiple conditions are combined with AND. Like dplyr's join_by(),
single columns are parsed as an equijoin condition (e.g., id becomes
x$id == y$id).
For a within-distance join, the distance threshold.
An object of class sedonadb_join_by containing the unevaluated
join condition expressions.
For programmatic usage, the .tables pronoun may be used to unambiguously
refer to a table qualifier (similar to the .data pronoun which may be
used in single-table SedonaDB verbs).
# Equality join on id column
sd_join_by(x$id == y$id)
#> <sedonadb_join_by>
#> x$id == y$id
# Can use just the column name as a shorthand
sd_join_by(id)
#> <sedonadb_join_by>
#> id
# Multiple conditions (combined with AND)
sd_join_by(x$id == y$id, x$date >= y$start_date)
#> <sedonadb_join_by>
#> x$id == y$id
#> x$date >= y$start_date
# Inequality join
sd_join_by(x$value > y$threshold)
#> <sedonadb_join_by>
#> x$value > y$threshold
# Spatial joins
sd_join_intersects()
#> <sedonadb_join_by>
#> .fns$st_intersects(.tables$x$geom(), .tables$y$geom())
sd_join_dwithin(100)
#> <sedonadb_join_by>
#> .fns$st_dwithin(.tables$x$geom(), .tables$y$geom(), 100)