Skip to content

Commit

Permalink
Fix #694
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Aug 16, 2023
1 parent 8aeb5e7 commit 018d9f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/utils_raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,16 @@ raster_as_matrix <- function(raster, downsample = FALSE)
#' @importFrom stats na.omit
raster_as_dataframe <- function(raster, xy = TRUE, na.rm = TRUE)
{
if (raster_is_proxy(raster))
ondisk <- raster_is_proxy(raster)

# Small rasters can be loaded on the fly
if (ondisk & raster_fits_in_memory(raster, n = 10))
{
raster <- raster_in_memory(raster)
ondisk <- FALSE
}

if (ondisk)
stop("On-disk rasters not supported in 'raster_as_dataframe()'", call. = FALSE) # nocov

m <- raster_as_matrix(raster)
Expand Down

0 comments on commit 018d9f9

Please sign in to comment.