diff --git a/R/lsp_add_spatial.R b/R/lsp_add_spatial.R index 40ad7fe..b162fd6 100644 --- a/R/lsp_add_spatial.R +++ b/R/lsp_add_spatial.R @@ -108,13 +108,13 @@ lsp_add_stars.lsp = function(x = NULL, window = NULL, metadata = TRUE){ if (metadata_attr$window_shift == 0) { output_stars = stars::st_as_stars(metadata_attr$bb, nx = 1, ny = 1, values = 1) names(output_stars) = "id" + } else if (is.null(window)){ + output_stars = lsp_create_grid(x_crs = metadata_attr$crs, + x_bb = metadata_attr$bb, + x_delta_row = metadata_attr$delta_y, + x_delta_col = metadata_attr$delta_x, + window_shift = metadata_attr$window_shift) } - } else if (is.null(window)){ - output_stars = lsp_create_grid(x_crs = metadata_attr$crs, - x_bb = metadata_attr$bb, - x_delta_row = metadata_attr$delta_y, - x_delta_col = metadata_attr$delta_x, - window_shift = metadata_attr$window_shift) } else { output_stars = stars::st_rasterize(window[1], template = stars::st_as_stars(metadata_attr$bb,