Skip to content

Commit

Permalink
st_join renames geom column to 'geometry' if x is st_sf with only a s…
Browse files Browse the repository at this point in the history
…t_sfc col.

z <- st_sf(pid=5, geom=st_sfc(st_polygon(list(matrix(c(0,0,4,0,4,4,0,4,0,0),ncol=2, byrow=T)))))
x <- st_sf(id=1:2, geom=st_sfc(st_point(1:2), st_point(2:3)))
st_join(x[,'geom'], z)
  • Loading branch information
faridcher authored Feb 5, 2024
1 parent 9073a52 commit 990ede2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/join.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ st_join.sf = function(x, y, join = st_intersects, ..., suffix = c(".x", ".y"),
if (inherits(x, "tbl_df") && requireNamespace("dplyr", quietly = TRUE))
st_sf(dplyr::bind_cols(x[ix,], y[unlist(i), , drop = FALSE]))
else
st_sf(cbind(as.data.frame(x)[ix,], y[unlist(i), , drop = FALSE]))
st_sf(cbind(as.data.frame(x)[ix, ,drop=FALSE], y[unlist(i), , drop = FALSE]))

}

#' @export
Expand Down

0 comments on commit 990ede2

Please sign in to comment.