Hot answers tagged

5 votes
Accepted

clip_roi dimension error

Your polygon has 3 coordinates including a Z. Drop z sf_object = sf::st_zm(sf_object) By the way your polygon is covering dozens of tiles. It means you are going to load in memory dozen of square ...
  • 8,343
4 votes
Accepted

Memory efficient way of using clip_roi for bigger areas

When using clip_roi() the default consists in loading the data in R as you noticed. However this function is also optimized to do not load anything at all in R if you put the output into a file. Each ...
  • 8,343
2 votes

Counting number of observations per pixel in a rasterstack

Example data library(terra) s <- rast(ncol=10, nrow=10, nlyr=5) set.seed(0) values(s) <- sample(c(1:4, NA), size(s), replace=TRUE) You can count the NAs like this sna <- sum(is.na(s)) And ...
2 votes

Counting number of observations per pixel in a rasterstack

library(terra) # Create rasters for example # Basic raster r1 <- rast(ncol=2,nrow=2) # Assign values to raster cells. Notice I put an NA in one. r1[] <- c(NA,2,3,4) # Second ...
  • 352
2 votes

Why doesn't terra::spin() work in R?

The help for spin says: Spin (rotate) the geometry of a SpatVector. and what you have is a raster, not vector, which we can see when you read the error message: Error in (function (classes, fdef, ...
  • 57.9k
1 vote

lidR, create table with numberofreturn by returnnumber in catalog

It is unclear what you are asking. This question seems to be about R not about lidR. If you want to force your table to be 7x7 you can do it this way but I'm not sure I answered the question. rn = ...
  • 8,343
1 vote
Accepted

Successfully mosaicking rasters in R, but the analysis is not showing values

Since you have only 3 out of 4 tiles in your mosaic, 1/4 of the mosaic are NA values. By default, range doesn't exclude NA's, so add na.rm = TRUE range(values(C_raster), na.rm = TRUE) You can also ...
  • 12.8k

Only top scored, non community-wiki answers of a minimum length are eligible