Skip to content

Commit

Permalink
fixes location of conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad committed Apr 21, 2023
1 parent 60a6c44 commit ac6aa65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/lsp_add_spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ lsp_add_stars.default = function(x = NULL, window = NULL){
}

if (is.numeric(window) && window != 0){
if (inherits(x, "SpatRaster")){
x = stars::st_as_stars(x)
}
x_crs = sf::st_crs(x)
x_bb = sf::st_bbox(x)
x_delta_row = stars::st_dimensions(x)[[1]][["delta"]]
Expand Down Expand Up @@ -203,7 +206,7 @@ lsp_add_terra = function(x = NULL, window = NULL){
if (!requireNamespace("terra", quietly = TRUE)){
stop("package terra required, please install it first") # nocov
}
output = lsp_add_stars(x = stars::st_as_stars(x), window = window)
output = lsp_add_stars(x = x, window = window)
output_names = names(output)
output = terra::rast(output)
names(output) = output_names
Expand Down

0 comments on commit ac6aa65

Please sign in to comment.