Questions tagged [r-raster]

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

Other resources

Related tags

1217 questions
0
votes
1 answer

Linear buffer when extracting from a raster file in R

This might be one for gis.stackexchange but - I'm working with raster data, and attempting to extract values. The problem I'm running into is that my coordinates do not always overlap with the raster data (I have coordinates on the coastline, and…
jebyrnes
  • 9,082
  • 5
  • 30
  • 33
0
votes
2 answers

Overlay rasters in r to meet three different conditions using ifelse

I'm trying to run an overlay function with rasters where I want to meet all of 3 different conditions at each cell (using == and > or < operators) and produce a single raster as output. Running ifelse with the & operator seems to look at the…
DJ77
  • 3
  • 2
0
votes
1 answer

Naming layers in a raster stack and extracting data

I have a raster stack/brick with 84 layers, each layer corresponding to a month of rainfall data from November 1999 to October 2006. I also have a data frame where each row contains (amongst other things) spatial coordinates and values for year and…
James
  • 1,164
  • 2
  • 15
  • 36
0
votes
1 answer

Wrong axes in raster converted from matrix

I have following code: library(raster) library(rasterVis) library(rgl) mz <- matrix(5:7, 2040, 10000) z <- raster(mz, xmn=0, ymn=0, xmx=ncol(mz)-1, ymx=nrow(mz)-1) plot3D(z) decorate3d() This creates following image As you can see y axis goes…
mcsim
  • 1,647
  • 2
  • 16
  • 35
0
votes
2 answers

R - Chaging specific cell values in a large raster layer

I am working with R "raster" package and have a large raster layer (62460098 cells, 12 Mb for the object). My cell values range from -1 to 1. I have to replace all negative values with a 0 (example: a cell that has -1 as value has to become a 0). I…
IGr14
  • 9
  • 2
0
votes
1 answer

Change NA values in raster layers and loop in several layers

I would like to change -1 values to NA values (-9999) in my ascii layers using the raster package in R. I know how to do this with one ascii layer, but would like to repeat this in multiple layers. I would like the output files to be named as the…
jl-blancopastor
  • 754
  • 5
  • 14
0
votes
1 answer

Raster Calc with KendallATS function from "smwrQW" package

This is my first question on StackOverflow. I am trying to use Mann-Kendall trend test on a brick of rasters consisting of 15 layers (time-series of counts) to make three rasters (sen slope, tau-b and p-value). I need to use tau-b and not tau-a,…
N-Acil
  • 3
  • 4
0
votes
1 answer

Vectorizing raster brick objects with r-raster so that I can count them

I have an image of columns of red and blue bordered circles like so: Where the columns alternate red and blue (in this example the first column is red) I have been able to create a raster brick and plot the image in RGB layers but I want to count…
0
votes
2 answers

Focal function: How do I get the value of the center pixel and use this value within the focal fun argument?

Example with a 3*3 neighborhood where the sum is multiplied with the center value "center". library(raster) r <- raster(ncol=10, nrow=10) r[] <- 1:100 f<-function(x,center) {sum(x)*center} r.f <- focal(r, w=matrix(1,3,3),fun=f}
burbot
  • 175
  • 1
  • 5
0
votes
1 answer

Sort Extracted Data Based On Image Region

I have analysed tree core images through the raster package in an attempt to perform image analysis. In the image: http://dx.doi.org/10.6084/m9.figshare.1555854 You can see the measured "vessels" (black and numbered) and also annual lines (red)…
Darren468
  • 41
  • 1
  • 6
0
votes
0 answers

main title in densityplot into grid.arrange raster stack data

I am using the function densityplot() and grid.arrange(), this is the example: library(rasterVis) library(gridExtra) library(raster) f <- system.file("external/test.grd", package="raster") r <-…
rral
  • 554
  • 3
  • 20
0
votes
1 answer

How to extract raster values from a RasterStackTS object using a shapefile?

I have a rasterstack and I need to extract the values from every raster using a shapefile. I know it's very easy with a "normal" rasterstack, but I have a RasterStackTS object. Unfortunately I must manage a RasterStackTS object, because I've…
FraNut
  • 676
  • 1
  • 11
  • 22
0
votes
1 answer

How to avoid argument name collision in R snow/ snowfall package, sfSapply?

I'm trying to use the snow and snowfall packages, specifically the sfSapply() function to extract data from multiple raster files. It looks something like this: queue <- list(rast1, rast2, rast3) sfInit(parallel=TRUE,…
Arthur
  • 345
  • 5
  • 12
0
votes
1 answer

In R create maximum raster from mulitple raster files

I am kind of new R so maybe its a stupid question but i cant figure it out myself. This is my problem. I have multiple asc files with the same gridsize and cover the same area. I want to get the maximum value for each grid from all the asc files. I…
IlhameO
  • 35
  • 7
0
votes
1 answer

writeOGR, read OGR does not provide X Y coordinates, which I need after clipping shapefile in R

I have made shapefiles from CSV by using the packages raster and rgdal, but I'd like to clip these shapefiles to a certain area, which I can do. However, when I write try to write.csv it does not work. Also, I lose X and Y after writeOGR. datansd =…
EJrandom
  • 29
  • 6