As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [stack]

stack in this context is intended for questions relating to the stacking of rasters, it is not intended for questions relating to a GIS software stack

Filter by
Sorted by
Tagged with
2 votes
3 answers
42 views

R raster stack mathematical conditioning operation

I am new to R and currently I am trying to create a drought frequency map using a stack of VHI rasters but, I still can't figure out a way. My attempt is as follows. The stack of rasters contains data ...
DilankaMunasinghe's user avatar
0 votes
0 answers
25 views

Stack some classifier probabilities for calculate MinDist of them

As I mentioned in title I calculated, SVM, CART, RF for my dataset. Now I need to stack them all. For each pixel I have 5 classes, so at the end, there will be 15 probability for each pixel. Then With ...
MohammadJavad Soltani's user avatar
1 vote
1 answer
77 views

Writeraster: How to mantain layer names when writing raster data to a file

After I change the extension of my different raster layers in R, I want to save them in the same folder to, later on, binarize them all (with a for in loop I have in my code). Because I want all these ...
Andrea Vidal's user avatar
0 votes
0 answers
34 views

How to stack/merge geom_stars items/plots in one - in R

If I have plotted the Relative Error Maps for the Silt soil attribute for the following 4 different soil types: Cambisols, calcisols, leptosols and fluvisols that form my study case area: ggplot() + ...
Dimitris K's user avatar
0 votes
1 answer
100 views

GEE- stack two different bands that are separated in different image collection to one image collection

I have two image collections. The first collection has 3 images ,each one has 1 band, the blue band of sentinel 2. The second collection has the same data as collection1, but the only difference is ...
Reut's user avatar
  • 1,920
0 votes
1 answer
45 views

Stacked image created, while most of the bands became masked

I am trying to do a crop-type classification, so I created a stacked image from my collection for training by RF. However, when the collection is stacked, most of the bands inside the stacked image ...
Samar Tarek's user avatar
0 votes
0 answers
73 views

Doing Layer stack in ERDAS Imagine

I am trying to do "Layer Stack" of Landsat 5 Surface Reflectance image in ERDAS Imagine 2015 but every time i get output as black and white image. Though pixels have RGB values but still ...
Kiran Choudhary's user avatar
0 votes
1 answer
448 views

Converting each image in image collection to separate bands with band names in Google Earth Engine

How do I create a stacked image from an image collection of Sentinel 1 images over a period? I am selecting only the ascending mode, and the VH polarization. If I use ".toBands()" at the end ...
Swadhina Koley's user avatar
0 votes
1 answer
532 views

How to stack list of Xarrays

I have a folder with 4 .tiff (GeoTiff) files. Each of these contains two layers (the spectral band and a mask). I'm able to create a list containig each image using xarray.open_rasterio. Now I need to ...
sermomon's user avatar
  • 912
1 vote
0 answers
78 views

Image Stacking showing is stacking all the bands in the whole image collection instead of images in the filtered image collection date

I have created my image collection of 36 images and I have mapped the NDVI function over it. I created a stacked image and assigned the kNDVI band to the image. However, it is showing 865 bands ...
Simba's user avatar
  • 79
2 votes
0 answers
307 views

Merge single- and multi-band rasters with stars

I can easily use c() to merge two single band rasters or two multi-band rasters using the R package stars, however, when I try merging a single band raster with a multi band raster, I get the error ...
Matt SM's user avatar
  • 1,811
0 votes
1 answer
210 views

Remove the pixel completely in stack if one layer contains NA values in R

I have a raster stack of soil temperatures from the year 2000 to 2020. I have previously cleaned out the individual layers if they exceeded the overall mean +/- 2 std.dev. by stacked <- stack("...
Thomas's user avatar
  • 847
2 votes
1 answer
133 views

Creating large covariate stacks with Google Earth Engine

I'm trialling using Earth Engine for a machine learning task (predicting pH) based on a large number (~300) of satellite covariates and around 100k training points. Earth Engine is attractive due to ...
Jamie Collinson's user avatar
0 votes
1 answer
67 views

Geolocating and writing many TIFFs at same time using R

I have found a way to give a PNG the CRS and location of a geolocated TIFF, and to convert the PNG to TIFF. Now I have to apply it to different PNGs in the same folder (all named Pt6_frame1, ...
Esteban Rodofili's user avatar
0 votes
0 answers
488 views

Extracting all levels of a NetCDF file and exporting as multiband raster

I am trying to convert this .nc file with land cover data from ESA CCI (http://maps.elie.ucl.ac.be/CCI/viewer/download.php). There is a separate .nc file for each year, and each file contains the ...
Megan Critchley's user avatar
0 votes
1 answer
480 views

How to keep same extent for my 10 raster files?

I am not able to keep same extent for my raster files and stack them together. library(raster) # for reproducible example r1 <- raster(xmn=72.23081, xmx=77.79537, ymn=34.26277, ymx=37.35659,res=1) ...
Ali Rawail's user avatar
1 vote
1 answer
708 views

"invalid 'times' value" error in stack function [closed]

I would like to stack multiple GeoTIFF file. My code looks like this: var1 <- list.files(path="D:/#This is the access path", pattern=".tif$", full.names=TRUE) var1 var2 <- ...
Nirevezs's user avatar
0 votes
1 answer
70 views

Issue with raster stacking

I tried raster stacking using the below code.I tried to read pixel values at a particular coordinate and few values are coming as zero where as when I tried reading the value before stacking there is ...
hashalluring's user avatar
1 vote
1 answer
3k views

How to calculate mean for multiple raster files and multiple variables using R

I have a folder with multiple raster files (.asc) which contains the biomass of different fish species (e.g., Anglerfish, Bathydemersal etc) for different years (e.g., 00012, 00024, 00036 etc) I want ...
Chiara Piro's user avatar
0 votes
1 answer
184 views

Raster image error when entering stack layers using Rstudio

I am a beginning user of Rstudio, and I want to run Random Forest by using a couple of "raster layers" which were stacked in ENVI. Before doing stacking I checked the cell size and the ...
user166551's user avatar
1 vote
1 answer
66 views

Why raster stack function changes the number of layers

I have a list of 12 rasters: IN_folder_S2 <- "T:\\New_SM\\Indices_UXC" IN.files_S2 <- dir(IN_folder_S2, pattern= "_11.tif$",full.names = T) IN.files_S2 IN.files_S2 [1] &...
user166416's user avatar
0 votes
0 answers
107 views

Add NDVI Date to stacked image in Google Earth Engine [duplicate]

I have created an Image collection in GEE, and I have computed NDVI index and mapped in each Imagen from Collection. Later, I create another collection with NDVI as a band, an finally Statacked in a ...
Cristian Patricio Salinas Tala's user avatar
8 votes
1 answer
14k views

R-4.0.1 Not sure I understand this message: Warning message: In proj4string(x) : CRS object has comment, which is lost in output [closed]

Context: I want to store the TIFF data to use it for running a linear regression model later on. Ultimate goal: Create a carbon map using field data as a basis. Libraries: library(sp) library(raster) ...
user13608970's user avatar
4 votes
1 answer
4k views

Calculation of mean and standard deviation of raster images in R

I have a set of raster images (GeoTIFF, Landsat 1984-2018) which I cropped with my AOI using a shapefile. Now I want to stack them and calculate the mean and standard deviation of every pixel of the ...
catherine 's user avatar
0 votes
1 answer
662 views

RasterLayer vs RasterStack

I have a few hundreds of .tiff files that I converted as a raster stack. However, when I tried reading the file, it is classified as a RasterLayer. I was expecting it to be a RasterStack. The ...
mand3rd's user avatar
  • 161
5 votes
1 answer
1k views

stars package in R. How to add time dimension in a stars object?

I have a raster stack (my_stack) and I converted it into a stars object: mystar <- st_as_stars(my_stack) That results in: stars object with 3 dimensions and 1 attribute attribute(s), summary of ...
Leonidas's user avatar
  • 473
0 votes
1 answer
609 views

Subset raster stack in R by a vector of number sequences?

I have a large raster stack that I need to subset by somewhat irregular time spans. I'd like to do something like this: rstack[[c(1:3, 4:8, 9:15)]] But there are 30 sequences like the ones above ...
Jason's user avatar
  • 131
1 vote
0 answers
195 views

Merging satellite images error

I am trying to merge 3 satellite images of 3 times. The images are median images. I have used the following code but there is an error. var maskL8 = function(image_m) { var qa = image_m.select('BQA'...
Shihab Nur's user avatar
0 votes
0 answers
56 views

Multi-seasonal image stacks in GEE

I want to stack layers of 3 images (median images from 3 seasons). I want to differentiate the land uses in different seasons. for example, there will be more waterbodies in rainy season but less in ...
Shihab Nur's user avatar
1 vote
2 answers
1k views

stack() in R does not include all .tiff files in my directory

I am trying to perform stack() in R using enhanced vegetation index (EVI) time-series maps but it doesn't include all the .tiff files in my directory. Here's the list of files when I dir(files.evi): ...
mand3rd's user avatar
  • 161
1 vote
1 answer
791 views

Determining which layer in raster stack is first to meet condition using R?

I want to analyze a raster stack and determine the first layer in the stack that meets a condition for every pixel. Here's a reproducible code example generating rasters and making a stack. # ...
Scott Z's user avatar
  • 141
0 votes
3 answers
360 views

Mosaicing of multitemporal Sentinel-2 images using ENVI

My aim is to combine several Sentinel-2 Level2A images of the same location/orbit number but at different dates of a year. I would like to have different options to create that mosaicing (e.g., if ...
xmisx's user avatar
  • 140
2 votes
1 answer
361 views

Biweekly time series for raster stack in r

I have a netcdf file with daily data and I calculate for each week some statistics, using the "apply.weekly" command in the "xts" library. However, I would like to calculate bi-weekly statistics, ...
Maria Karypidou's user avatar
1 vote
0 answers
36 views

How do I compare multiple years worth of geomorph changes in a river while drawing one profile line?

I have many years worth of DEMs of a river I'm studying. I'm very, very new to ArcGIS (think one intro class), and learned how to use the 3D analyst tool. What I'd like to be able to do, is to draw ...
user137960's user avatar
1 vote
2 answers
3k views

Looping a raster stack with a step, R

I have a large raster stack of about 500 rasterlayers. What I want to do is to extract specific layers and store them in a different strack. The layers for which I am interested in, have a step of 8 ...
foo's user avatar
  • 186
0 votes
1 answer
712 views

Using raster stack function time in R?

I successfully ran a function over a smaller test raster stack (48 layers) in about 30 minutes but cannot run it over my large stack (1462 layers). The last one I tried over the large stack ran from ...
Rachel Rotz's user avatar
0 votes
1 answer
364 views

Plot a series of subsetted pixels from a raster stack in R

I have created two raster stacks and would like to plot a row or column of pixels through the stack, but am not sure how to approach this. I know I can subset by layer, but how do I subset ...
Rachel Rotz's user avatar
0 votes
2 answers
287 views

Why does the Extent of NIR Band 8 Landsat image not match other bands, even when cropping to a specified extent?

I'm trying to load and then stack four bands 2,3,4 and 8 RGB and NIR from Landsat images. I have downloaded and extracted them and they are in .tif format. # loading the bands B2 <- raster("./...
TomCLewis's user avatar
  • 101
0 votes
2 answers
983 views

Raster operations in a raster list in R

I have a raster list (21 in total) S1 that have the same projection, resolution but not exactly the same extent. Due to this difference, I cannot stack them without solving the extent/dimensions ...
GCGM's user avatar
  • 1,108
3 votes
1 answer
8k views

Import multi-band TIFF in R

I am trying to import a TIFF file that contains 2 bands. When using the following code in R, it seems only the first band is being recognised. S1<-"my/path/" S1<-list.files(S1, full.names = ...
GCGM's user avatar
  • 1,108
1 vote
0 answers
201 views

How to save statistical parameters of a raster stack in a csv using R

I have a reference raster and a stack of other rasters. I wanted to perform Mean, Std Dev and Bias of the reference with respect to the remaining. So I calculated the Cell Stats of all but when I try ...
ARU's user avatar
  • 13
6 votes
1 answer
598 views

Stacking and masking Landsat at the same time with rasterio

Based on answers from previous questions 1,2 and the Masking a raster using a shapefile guide from rasterio cookbook, I wrote the code below. The code runs correctly. I would like to improve it. 1- ...
mlateb's user avatar
  • 139
6 votes
1 answer
5k views

Add bands' name and description to the Metadata when stacking using rasterio

I'm using this code, of @Loïc Dutrieux, to stack 8 Landsat bands. with rasterio.open(final_list[0]) as src0: meta = src0.meta with rasterio.open('stack.tif', 'w', **meta) as dst: for id, layer ...
mlateb's user avatar
  • 139
0 votes
2 answers
1k views

Selecting layers of a raster stack using a sliding windows as a step in R in for loop

I would like to create a loop that every time selects the first ten layers of a raster stack, calculates their mean and saves it to a layer of a new raster stack. Also, I would like to have a step ...
Maria Karypidou's user avatar
0 votes
1 answer
496 views

Google Earth Engine: Stack an ImageCollection

Does anyone know how can I stack all this collection? I made my own collection from January Landsat images (L7 and L5) and I would like to stack all the images to check which are the areas with more ...
Juan TB's user avatar
  • 373
3 votes
1 answer
3k views

Raster calculation loop - R

I have a raster stack of 108 elements The stack 'images' is created using 4 bands (RGB+NIR) of 27 satellite images. The sequence of the rasters in the stack is: Position [[1]]: blue band image 1 ...
GCGM's user avatar
  • 1,108
11 votes
3 answers
14k views

How to stack bands in Google Earth Engine?

I have created an Image collection in GEE and with the help of a function I have computed NDVI index and mapped it to create another collection with NDVI as a band. Now I want the create a stacked ...
Rawail Naeem's user avatar
7 votes
3 answers
13k views

Stack rasters with different origin, dimensions and resolution in R

I have three raster files with the same extent and CRS, but with different origin, dimensions and resolution. r1 class : RasterLayer dimensions : 3020, 3043, 9189860 (nrow, ncol, ncell) ...
Elena's user avatar
  • 73
4 votes
1 answer
1k views

How to create raster stack from names on R

I have a dataframe containing the best predictors by their contribution to a model: bestpredictors var contrib 2 Pfallwinter 8.1141 15 Tofall 58.0000 23 ai 5.3573 26 ...
Diego Parra Muñoz's user avatar
1 vote
0 answers
326 views

Is it possible to list SpatialGridDataFrame files to be used in a loop?

I have a lot (>50) of SpatialGridDataFrame files that I need to turn into raster files, stack with a set of raster files I already have and then extract data from random points from each layer of all ...
J. Cee's user avatar
  • 33