Skip to content

Commit e4dcb04

Browse files
committed
...
1 parent 151641b commit e4dcb04

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ URL: https://mlr3spatial.mlr-org.com,
1717
https://github.com/mlr-org/mlr3spatial
1818
BugReports: https://github.com/mlr-org/mlr3spatial/issues
1919
Depends:
20-
mlr3 (>= 1.1.0),
20+
mlr3 (>= 1.2.0),
2121
R (>= 3.1.0)
2222
Imports:
2323
checkmate (>= 2.0.0),

R/data.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay
9898
if (layer$type == "numeric") {
9999
data = matrix(c(stats::rnorm(floor(dimension^2 / 2), 0, 1), stats::rnorm(ceiling(dimension^2 / 2), 1, 1)), nrow = dimension)
100100
ras = rast(data)
101+
terra::crs(ras) = "EPSG:4326"
101102
if (!layer$in_memory && !multi_layer_file) {
102103
filename = tempfile(fileext = ".tif")
103104
writeRaster(ras, filename)
@@ -107,6 +108,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay
107108
} else if (layer$type == "factor") {
108109
data = matrix(rep(seq_along(layer$levels), each = floor(dimension^2 / length(layer$levels)), length.out = dimension^2), nrow = dimension)
109110
ras = rast(data)
111+
terra::crs(ras) = "EPSG:4326"
110112
ras = terra::categories(ras, layer = 1, data.table(ID = seq_along(layer$levels), category = layer$levels))
111113
if (!layer$in_memory && !multi_layer_file) {
112114
filename = tempfile(fileext = ".tif")
@@ -117,6 +119,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay
117119
} else if (layer$type == "weights") {
118120
data = matrix(runif(dimension^2, 0, 1), nrow = dimension)
119121
ras = rast(data)
122+
terra::crs(ras) = "EPSG:4326"
120123
if (!layer$in_memory && !multi_layer_file) {
121124
filename = tempfile(fileext = ".tif")
122125
writeRaster(ras, filename)

tests/testthat/test_DataBackendRaster.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ test_that("data prototyp works", {
273273
)
274274
backend = DataBackendRaster$new(stack)
275275

276-
expect_data_table(backend$data(rows = integer(0), cols = c("x_1", "y")), nrows = 0, ncols = 2)
276+
suppressWarnings(expect_data_table(backend$data(rows = integer(0), cols = c("x_1", "y")), nrows = 0, ncols = 2))
277277
})
278278

279279
test_that("in memory rasters work", {

0 commit comments

Comments
 (0)