You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes I want to join two spatial datasets to see which geometries are in both datasets, which geometries are only in x, and which geometries are only in y. As far as I can tell, there only seems to be support for left and inner joins currently. My workaround is a somewhat annoying and inefficient task, where it is necessary to run the intersection on the inner rows twice and then remove duplicated inner rows, which is problematic when the datasets have a large number of intersecting geometries:
# get all rows of ajoin_a_left=data_a|>
st_join(data_b, left=TRUE)
# get all rows of bjoin_b_left=data_b|>
st_join(data_a, left=TRUE)
# row bind join resultsa_b_join=join_a_left|>
bind_rows(join_b_left) |>
distinct() |># remove duplicated rows that exist in both a and b
mutate(
dataset= case_when(
a=='a'& is.na(b) ~'a',
a=='a'&b=='b'~'both',
is.na(a) &b=='b'~'b'
)
)
ggplot() +
geom_sf(
data=a_b_join,
aes(color=dataset)
)
Instead, I would love to see support for full joins within st_join(). I could imagine this looking something like:
where the argument style would replace left and could accept several options (at least "left", "inner", and "full". maybe "outer"?). I haven't really thought about the name of the argument, "style" was just the first vaguely relevant sounding term I came up with...
The text was updated successfully, but these errors were encountered:
Sometimes I want to join two spatial datasets to see which geometries are in both datasets, which geometries are only in x, and which geometries are only in y. As far as I can tell, there only seems to be support for left and inner joins currently. My workaround is a somewhat annoying and inefficient task, where it is necessary to run the intersection on the inner rows twice and then remove duplicated inner rows, which is problematic when the datasets have a large number of intersecting geometries:
Instead, I would love to see support for full joins within
st_join()
. I could imagine this looking something like:where the argument
style
would replaceleft
and could accept several options (at least "left", "inner", and "full". maybe "outer"?). I haven't really thought about the name of the argument, "style" was just the first vaguely relevant sounding term I came up with...The text was updated successfully, but these errors were encountered: