Skip to content

Commit

Permalink
r
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Jan 7, 2025
1 parent 8f7c378 commit 404caa8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/extent.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ setMethod("ext", signature(x="SpatVector"),
}
)

setMethod("ext", signature(x="SpatVectorCollection"),
function(x) {
e <- sapply(x, function(e) as.vector(ext(e)))
ext(min(e[1,]), max(e[2,]), min(e[3,]), max(e[4,]))
}
)


setMethod("ext", signature(x="SpatVectorProxy"),
function(x) {
e <- methods::new("SpatExtent")
Expand Down
9 changes: 9 additions & 0 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,15 @@ setMethod("project", signature(x="SpatVector"),
}
)

setMethod("project", signature(x="SpatVectorCollection"),
function(x, y, partial=FALSE) {
x <- lapply(x, function(v) project(v, y, partial=partial))
svc(x)
}
)



setMethod("project", signature(x="SpatExtent"),
function(x, from, to) {
if (missing(from)) error("project", "'from' cannot be missing")
Expand Down
1 change: 1 addition & 0 deletions man/ext.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
\alias{ext,SpatExtent-method}
\alias{ext,SpatRaster-method}
\alias{ext,SpatVector-method}
\alias{ext,SpatVectorCollection-method}
\alias{ext,SpatVectorProxy-method}
\alias{ext,SpatRasterDataset-method}
\alias{ext,SpatRasterCollection-method}
Expand Down
1 change: 1 addition & 0 deletions man/project.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\alias{project}
\alias{project,SpatVector-method}
\alias{project,SpatVectorCollection-method}
\alias{project,SpatRaster-method}
\alias{project,SpatExtent-method}
\alias{project,matrix-method}
Expand Down

0 comments on commit 404caa8

Please sign in to comment.