All Questions
17 questions
0
votes
0
answers
21
views
stars and st_apply: summarise NetCDF for each timestamp and create multiple new attributes
I have a stars-object like this one:
https://drive.google.com/file/d/1qcMATPjSyw-Rk9WpfFTa1rpr7dtOUxsu/view?usp=drive_link
It looks like this:
nc = read_stars("~/Desktop/SPARTACUS - Spatial ...
1
vote
0
answers
101
views
Georeferencing rasters using GCPs in R: stars/terra equivalent of gdal_translate / gdalwarp?
With the retirement of rgdal and transition to sf/stars/terra functions in October 2023 now passed, is there a way of georeferencing raster images with GCPs (Ground Control Points) other than using ...
0
votes
0
answers
588
views
How can I project very large rasters with terra, raster or stars packages in r?
I am trying to project a very large raster (about 7GB each) from NAD 1983 UTM Zone 16N to Wisconsin Transverse Mercator (ESPG:3071) and neither the terra nor the raster package seem to work. Terra ...
0
votes
1
answer
211
views
Find cells with maximum value per dimension in stars object (R)
I would like to find the cells, and their corresponding centroid, that hold the maximum value for each band in a multiband raster.
Converting the stars-object to a sf-dataframe makes this easy somehow....
0
votes
1
answer
200
views
Reading and writing VRTs differ in size and values when using Terra and Stars
I want to use the tree cover density layer from copernicus (https://land.copernicus.eu/pan-european/high-resolution-layers/forests/tree-cover-density/status-maps/tree-cover-density-2018?tab=download)
...
0
votes
1
answer
381
views
R: Wrong transformation from SpatRast (terra) to stars object
When I transform my SpatRast object to a stars object, suddenly the the location of my origin changes. I need the location of the origin to be an exact point (376491.4,5875118.5, EPSG:25833), as I am ...
1
vote
1
answer
359
views
Modify raster coordinates (wrong projection) using stars or terra
I downloaded a raster image from the following address, which corresponds to rivers and streams in the Barcelona area.
https://geoserveis.icgc.cat/icgc_geotecnicbcn25m/wms/service?REQUEST=GetMap&...
0
votes
0
answers
378
views
Apply function at grid cell level across layers of a raster file
I have a netcdf raster object with multiple layers (time: 30 years * 12 month = 360 steps).
The raster is constituted of multiple grid-cells (say 1000). I want to linearly detrend each month ...
1
vote
0
answers
208
views
Recursively mosaic rasters by directory (year) in R
I have hundreds of rasters spanning 10 years, files are stored by year (e.g., 2020, 2019, 2018, etc.). I would like to mosaic all the raster files within a directory, move to the next directory and ...
4
votes
1
answer
2k
views
Mask a (raster) stars object in R with a vector (sf) object
In this question an stars object is masked with a raster object. But it is not clear to me how the masking can be done with a vector object using the stars pkg.
Consider the following example in terra....
3
votes
2
answers
821
views
What's the most efficient way to calculate line length per raster cell in R?
Problem
I'm looking for an efficient, memory friendly to calculate total line (vector data) length per raster cell.
The question of line length per cell has already been posed here in 2014 and a few ...
2
votes
2
answers
1k
views
Calculate area weighted mean values of polygons for raster cells using R
Problem
I want to rasterize polygon values and assign their weighted mean to raster cells.
Weighting should be done based on the polygons' cell coverage.
Problem visualized
Calculation for grid cell ...
3
votes
1
answer
2k
views
Rasterizing and resampling a vector object using stars::st_rasterize() and terra::rast() loses values/data
I am currently struggling with rasterizing and later, resampling a vector object using functions from stars and terra.
Let's start with the example dataset here: https://drive.google.com/drive/u/2/...
1
vote
1
answer
299
views
Comparing polygon areas across simple feature collections
I currently have three simple feature objects created from different shapefiles in R using the sf package. These three objects have all been projected to the same coordinate system using st_transform()...
1
vote
2
answers
141
views
Is there an equivalent of "isLonLat" function in terra package in R?
I am refactoring my code which extensively relied on raster package to now use the newer and better terra package. I was making use of the isLonLat() function that returns TRUE if the crs of a raster ...
2
votes
1
answer
560
views
Expand stars-raster in R
In the r-package terra there is the function terra::extend. To my understanding it just expands the raster with no data values on each side right?
I wanted to do something similar, but using a stars ...
3
votes
1
answer
753
views
How to test whether the argument passed to an R function is a raster or a vector
I am writing a function that expects two arguments: X and Y. Argument X should be a raster which can be generated by packages such as raster, terra, or stars.
Argument Y should be a polygon from ...