From 91e79654d16415b8dd29e3b095f9ecb518c7c5f9 Mon Sep 17 00:00:00 2001 From: edzer Date: Thu, 7 Nov 2024 15:13:05 +0100 Subject: [PATCH] fix for CRAN release; #705 --- DESCRIPTION | 1 - R/rasterize.R | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 802d09df..a5d2fec7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,7 +36,6 @@ Depends: R (>= 3.3.0), abind, sf (>= 1.0-19) -Remotes: r-spatial/sf Imports: methods, parallel, diff --git a/R/rasterize.R b/R/rasterize.R index 056f4e47..f3b5a522 100644 --- a/R/rasterize.R +++ b/R/rasterize.R @@ -97,7 +97,10 @@ st_rasterize = function(sf, template = guess_raster(sf, ...) %||% ret[[i]] = structure(ret[[i]], class = class(attrs[[i]]), levels = levels(attrs[[i]])) } } - ret + if (n_attr <= 1) # no names in bands + setNames(ret, names(attrs)) + else + ret } guess_raster = function(x, ...) {