1,263 questions
1
vote
1
answer
32
views
How to rasterize vector polygons with biomass values proportionally to pixel coverage?
I have a set of vector polygons representing tree crowns. Each polygon has an associated biomass value. I want to rasterize this dataset into a 10m x 10m raster, where each pixel contains the sum of ...
0
votes
1
answer
51
views
Raster calculations parallelisation on hpc using a shiny app
I am currently developing a shinyapp for rastercalculations similarly like:
https://github.com/NEPEM-UFSC/plimanshiny
I am developing it to run on a high performance cluster because I want to ...
1
vote
2
answers
61
views
Averaging multiple rasters while considering NA pixels
I am using MODIS11A2 LST 8-day average raster .tif data to calculate daily average for the year. For year 2001, I have 44 files (2 files are missing). I want that a pixel should be excluded from the ...
0
votes
1
answer
48
views
Reprojection between CRS for raster data in R
I have two large raster datasets in R with different coordinate reference systems (CRS) and resolutions (they cover the whole world surface):
• Raster 1: World Mollweide projection, 10 km² ...
0
votes
1
answer
36
views
Writing categorical raster with dbf file does not contain pixel counts
I am trying to write a rasterize vector file with dbf file using the following code
library(terra)
library(foreign)
f <- system.file("ex/lux.shp", package="terra")
v <- vect(...
3
votes
2
answers
76
views
Extent is rewritten for separate SpatRaster when modifying extent using terra in R
This is truly bizarre behavior I can't explain.
library(terra)
r1 = rast(nrow = 2, ncol = 2)
values(r1) = c(0, 1, 2, 3)
r2 = r1
ext(r2) = ext(r2)/2
ext(r2)
ext(r1)
What you see is that the extent of ...
0
votes
0
answers
32
views
Snow Package Stop Cluster and Progress Bar Not Working
I am using the Snow package to run some DEM modifications in Parallel as I have lots of DEMS that I need to reproject. I am having an issue where my cluster does not stop when I run the "...
1
vote
1
answer
62
views
Unable to set CRS for list of raster maps using function/loop in R
I have a list of raster map bricks created by cropping existing rasters. I also have a csv metadata file which includes the EPSG code for each raster. The crs info within the cropped rasters, ...
0
votes
1
answer
305
views
Mask and Crop functions in Terra R
When the raster package was still active, I would usually have to do the following to crop the rasterlayer to an irregular polygon (with some functions updated for terra). I am wondering there is a ...
0
votes
1
answer
114
views
Changing R Temporary Files [closed]
I built custom functions for sequential resampling, clipping, and writing raster stacks from CHIRPS, Modis, and ERA5. After considering that I work over an extensive area and long temporal period (...
0
votes
0
answers
74
views
Is there a better and effective way to convert a large raster file into a vector point?
The idea is to convert some raster files (39 fire occurrences) into vector points (.shp), allowing the use of the extract() function in the terra package to relate the occurrence points to another ...
1
vote
0
answers
87
views
{rast] cannot open this file
I am working with the terra package to read a raster file.
narr <- rast(paste0(
"/ YOUR FILE PATH /narr_air2m_",
year,
".nc"
))
When I run this code, I encounter the ...
0
votes
1
answer
81
views
Reading netcdf in R with lon lat dimensions reported as single 1D vector
I need to work with these data in R: https://zenodo.org/records/1209296 in particular "irrigation water use v2.7z". I opened the netcdf inside R both with terra and raster library. I should ...
1
vote
1
answer
101
views
Incorrect result when I reproject a SpatialPolygonsDataFrame using spTransform()
R version 4.4.0 (2024-04-24 ucrt) -- "Puppy Cup"
Platform: x86_64-w64-mingw32/x64
I have a very complex SpatialPolygonsDataFrame representing a Natura 2000 site from Sweden, SE0820430, shown ...
0
votes
1
answer
81
views
boxplot of raster and shapefile
This example code works
library(raster)
library(sp)
library(rgdal)
library(ggplot2)
# Create some sample raster data
raster_file <- raster(ncol=36, nrow=18)
raster_file[] <- 1:ncell(raster_file)...