Skip to content

Commit 6a9e35f

Browse files
committed
fixes #2532
1 parent b3393c4 commit 6a9e35f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/spatstat.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ as.owin.sf = function(W, ...) {
195195
}
196196

197197
#' @export
198-
st_as_sfc.owin = function(x, ...) {
198+
st_as_sfc.owin = function(x, ..., crs = NA) {
199199
# FROM: methods for coercion to Spatial Polygons by Adrian Baddeley, pkg maptools
200200
check_spatstat("spatstat.geom")
201201
# Check internal spatstat multiplier:
@@ -220,6 +220,7 @@ st_as_sfc.owin = function(x, ...) {
220220
w = which.min(st_area(exteriors[ cb[[i]] ]))
221221
pieces[[w]] = st_polygon(c(unclass(pieces[[w]]), unclass(holes[[i]])))
222222
}
223+
st_crs(pieces) = crs
223224
if (length(pieces) > 1) # multiple POLYGONs, collapse:
224225
st_sfc(do.call(c, pieces))
225226
else

0 commit comments

Comments
 (0)