Questions tagged [r-raster]

raster is an R package for geographic data analysis and modeling.

Other resources

Related tags

1217 questions
0
votes
2 answers

How to run the Kennard-Stone algorithm with a multilayer raster?

I am dealing with a spatial dataset that I need to divide into a training and a validation subset. To be specific, I have a raster with 31 bands; I need to use all of them as parameters for the division of the dataset into the two subsets. I wish to…
0
votes
1 answer

Extract values from PCA on raster

pcaRasters $call rasterPCA(img = predictors) $model Call: princomp(cor = spca, covmat = covMat[[1]]) Standard deviations: Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 Comp.9…
sungirai
  • 1
  • 2
0
votes
1 answer

Raster image not working beyond 180 in leaflet for R

I am trying to plot a raster over New Zealand in leaflet but I am having some issues. I've found that polygons and points/markers plot as expected: library(raster) library(leaflet) library(dplyr) library(sp) p1 <-…
0
votes
1 answer

R - how to plot several rasters with different colors

I'm using R for a climate research study and I'm trying to draw a map with a digital elevation model as base layer. I want to plot another (smaller) raster (containing climate information) on top of this dem, obviously with different colors. The…
user975296
  • 531
  • 1
  • 4
  • 3
0
votes
1 answer

Querying rasters to create result raster

I have two environmental rasters for the same extent etc, and dataframe of model results (which contains all possible combinations of env1 and env2). I am trying to create a third raster filled with model results for each cell. library(raster) ##…
Reed
  • 308
  • 2
  • 14
0
votes
2 answers

Calculating area of raster with certain values in R

I have a raster image (.tif) with continuous values in each pixel between 0 and 1. I want to calculate the area (can be a number of pixels too) in this raster which has values in a set of value intervals: i.e. 0.1 - 0.2, 0.3 - 0.4, 0.7 - 0.8. The…
MIH
  • 1,083
  • 3
  • 14
  • 26
0
votes
1 answer

Delete cells of grid whose centroid is not over a raster

I have two problems. Problem 1: I would like to delete all cells of the grid whose centroid is not located over the raster. I'm not even sure if I'm working with the right "types of objects" (RasterLayer, SpatialPixels, etc.). See example with…
user6094832
0
votes
2 answers

Calculating number of three consecutive values above a threshold (in raster stack)

I need to compute number of three consecutive days when value of each pixel in a raster stack (x) is above a given threshold (defined by another raster y). I tried using rle for the purpose with calc as follows after stacking x and y together into…
rar
  • 894
  • 1
  • 9
  • 24
0
votes
1 answer

Plot XYZ Points On Raster Layer

I would like to display a set of points over a raster layer, and have them colored on the same scale as the raster. I've looked through other questions but have not solved it. The point values represent concentrations at 30 stations. The raster…
user1868064
  • 221
  • 1
  • 2
  • 7
0
votes
1 answer

Error while extracting netcdf files into raster

I have many NCDF files in a folder. I try to extract them into raster brick using raster and ncdf4 packages. If I separately extract each NCDF file it works. However, I try to extract all files using for loop then it gives me…
rar
  • 894
  • 1
  • 9
  • 24
0
votes
0 answers

Loading multiple rasters in R results in some with attributes

I am trying to load multiple rasters (87 in total) into R for analysis. The rasters are being loaded direct to a stack using this code: filelist <- list.files(path="mypath", pattern="tif$", full.names=TRUE) stk1 <- raster::stack(filelist) The data…
ChrisY
  • 1
  • 3
0
votes
1 answer

Multiple Raster Boxplots in R

I am trying to make a figure that has a boxplot for 14 different rasters. Each raster represents the snow depth surface for a given 100m elevation band, from 1300-2600 masl. I know how to make a boxplot for each raster individually, but cannot…
Kelsey C.
  • 1
  • 4
0
votes
2 answers

Expected result is not printed for a for loop

I have 14 raster files in Tiff format and I want to read values of a series of pixels (same file location). However, when I ran the R code, the expected results did not show up. Could you tell me why? #set working directory# path <-…
sherryL
  • 13
  • 6
0
votes
1 answer

focal {raster} regression with RasterStack

I am trying to run a multivariate regression with different layers in a RasterStack using focal {raster} or localFun {raster}. With the help of a similar post and the raster reference manual, my code works fine with single RasterLayers as input (see…
Sands
  • 25
  • 5
0
votes
2 answers

Creating new color palette for plotting raster

I have a raster image that I try to plot using rasterVis package in BuRdTheme. But I find the colors to be dull. However, what I need is something like following. How can I create this desired pallete in raster or rasterVis or if any other package…
rar
  • 894
  • 1
  • 9
  • 24