0

Want to change higher spatial resolution UAV dataset stacked in R. Used raster package to stack the individual band. Want to change the spatial resolution to 1 m.

stacked_UAV  <- stack(stack_list)
### Check the original resolution 
res(stacked_UAV)
0.0289 0.0289
## Number of rows original stacked image 
ncol(rast) <- stacked_UAV@ncols 
ncol(rast)
5193
## Number of rows original stacked image 
nrow(rast) <- stacked_UAV@nrows
nrow(rast)
13680

Tried following options using "raster package' but failed to get the target 1 m spatial resolution.

test_with_aggregate <- aggregate(stacked_UAV, fact=4)
res(test_with_aggregate)
0.1156 0.1156

Then tried to use the 'resample' function in the raster package but could not get the target spatial resolution due an error in setting spatial resolution to 1 m, this option is also not working.

### Empty stack
rast <- stack()
### Same spatial extend as the original stack 
extent(rast) <- stack(stacked_UAV) 
## Set resolution 
res(rast) <- 1
Error in x@layers[[i]] : subscript out of bounds
stacked_UAV_1 <- raster::resample(stacked_UAV, rast, method='bilinear')
  • aggregate with fact=4 on a raster with resolution 0.0289 will produce a raster of resolution 0.0289 *4 = 0.1156. If you use fact=35 you should get a raster with resolution 0.0289*35 = 1.0115. Is that close enough to a metre for your purposes? – Spacedman Jan 9 at 23:53
  • Issue with I have time series of UAV data-sets. I want to have a consistent spatial resolution of 1 m across all the images. – SBK_DA Jan 9 at 23:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.