Skip to content

Commit

Permalink
update st_as_sfc.SpatialPoints; see also #2060
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Dec 14, 2022
1 parent b16648e commit 1bfb7ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/sp.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ handle_bbox = function(sfc, sp) {
st_as_sfc.SpatialPoints = function(x, ..., precision = 0.0) {
cc = x@coords
dimnames(cc) = NULL
lst = lapply(seq_len(nrow(cc)), function(x) st_point(cc[x,]))
handle_bbox(do.call(st_sfc, append(lst, list(crs = st_crs(x@proj4string),
precision = precision))), x)
lst = vector("list", length = nrow(cc))
attr(lst, "points") = cc
attr(lst, "points_dim") = "XY"
handle_bbox(structure(st_sfc(lst, crs = st_crs(x@proj4string), precision = precision), n_empty = 0), x)
}

#' @name st_as_sfc
Expand Down

0 comments on commit 1bfb7ea

Please sign in to comment.