# Tagged Questions

45 views

### Max cell value from a stacked raster

How can I find a max cell value from a stacked raster. Rmax <- maxValue(RAD1998.all[[1]]) works fine but Rmax <- maxValue(RAD1998.all[[2]]) gives NA. Of course not in a stacked raster. ...
46 views

### How to overlay a county boundary on a raster file?

I want to overlay California county boundary top of raster layer. Here is is my code: data(coastsCoarse) data(countriesLow) library(gtools) library(maps) library(maptools) library(sp) # Raster ...
43 views

### How are kappa and overall accuracy related with respect to thematic raster data?

I recently calculated kappa (using confusionMatrix{caret} in R) between a thematic raster dataset at 1m spatial resolution and another at 30m spatial resolution. I was interested in quantifying the ...
35 views

### Levelplot(RasterVis) two marginal plot scale?

How can I add/display scale to two marginal plot? RAD1998.all <- stack(list.ras) list.files <- mixedsort(list.files(paste(getwd(), "/1998bil/", sep = ""), full.names = F, pattern = ...
44 views

### levelplot index issue

levelplot with static index works fine but not in a for loop. What's wrong with my code? Static index: png(paste("1998",outlist[[1]],".png",sep="")) levelplot(RAD1998.all[[1:4]]) dev.off() ...
42 views

### R -plot 12 images per plot or save 12 images per image file in R

Here is R script and my question is How can I plot 12 images per plot or save 12 images per image file because I have total 864 images. RAD1998 <- raster(paste(getwd(), "/1998bil ...
30 views

### R giving error when attempting map algebra

I'm trying to manipulate some downloaded rasters using R, and keep getting the same error when I try to do any type of map algebra. The example below uses a raster file downloaded from ...
20 views

### How to calculate average raster values around a set of points (ArcGIS or R) [duplicate]

I have a 30-m elevation raster as well as a set of points that overlay the raster. For each point, I want to calculate the average elevation within a 5-km radius of the point. One way I was ...
55 views

### Projection mismatch when plotting precipitation with ggplot

I'm trying to plot accumulated precipitation in Brazil for a given period, see code below: Load packages library(raincpc) library(SDMTools) library(raster) library(ggplot2) library(rgdal) ...
66 views

### NAs not allowed error message in attempt to plot raster object in R

I have imported a clipped raster (performed in ArcGIS 10.1) from the National Landcover Dataset into R, but when I try to plot I get the following error message. Error in .readCellsGDAL(x, ...
32 views

### Cannot properly import MODIS MOD07_L2 .hdf files into R using rgdal

I've been trying to accurately import and process some .hdf files from the MODIS Atmospheric Profile product (MOD07_L2) in R for several days now. Still, there's something going wrong during data ...
22 views

### R{raster} getValues(): error accessing values of large raster

I am getting the following, while extracting all values with: rs<-getValues(rster) Error in getRasterData(con, offset = offs, region.dim = reg, band = object at data@band): long vectors not ...
36 views

### R: Can raster predict function pass to predict.rfsrc (a prediction function in a parallel verion of RandomForest)?

It seems that raster predict function can pass to predict.randomForest by setting the "type='response'". I am using a parallel version of randomForest package called the "randomForestSRC" and I am ...
57 views

### Display two-dimensional color gradient for two different quantities

I have two overlapping raster layers. One contains quantity A from 0 to 100, and the other contains quantity B from 0 to 100. I'd like to create a map displaying both sets of data at once based on a ...
68 views

### How to mosaic rasters in R?

I am trying to mosaic several rasters into single big raster in R. Using script that posted in http://stackoverflow.com/questions/15287807/how-can-i-create-raster-mosaic-using-list-of-rasters But, I ...
44 views

### How do I convert a .bil (and associated .clr, .blw, .hdr, and .stx) files into georeferenced rasters in R? OR to geotiffs using gdal_translate?

The title says it all. I've got a bunch of .bil files, which I can open in R using the raster command pointed to the path to the .bil file. But I don't know how to efficiently incorporate the ...
64 views

### Simplest way to limit the memory that the raster package uses in R

What's the easiest way to limit the memory the raster package uses in R to 5GB of RAM? Ideally I want any raster that exceeds this size to be written to the hard drive and analysed from a temporary ...
76 views

### Step-by-step: How do I extract Raster values from Polygon overlay with Q-GIS or R?

I am writing my master thesis at the moment and am having the exact same problem as user Curley in this question: I first need to overlay a Corine 2006 raster with a polygon layer (2638 polygons). ...
64 views

### R plot raster with real colors

I'have a raster image from Scran25 IGN. In Qgis, it opens perfectly but in R (with rgdal or raster packages), I do not know how to keep the original colors like this exemple? I have tried ...
71 views

### Error in which.max() : not yet implemented for large objects in R

I am going to create raster by Julian day that observed maximum value of NDVI within a single year. Actually, I want to know which julian day (or raster) has max value in each cells and get result by ...
73 views

### How to create raster map by day that observed maximum NDVI from multiple raster data in R?

I have 11 NDVI raster data, representing single summer. I want to create raster by day (Julian day or name of raster) that observed maximum value. In other words, I want to know which day (which ...
25 views

### Overlaid raster gets shifted around when printing to pdf or when resizing graphics device with mouse

I've spent the past couple of days learning how to use the maps, raster, and rgdal packages to create nice images, but I'm running into trouble when trying to make pdf's for actually presenting. I'm ...
48 views

### Alternatives to bilinear interpolation for raster extraction in R

I have a set of coordinates for which I want to extract temperature values from a raster. I am using the extract function from the raster library in R. Looking at the interpolation methods, there are ...
54 views

### Is it permissible to redefine raster resolution (not resample!) in order that it be included in a SDM?

I'm fitting a SDM using R. A requirement is that all environmental predictor layers have the same extent, origin and resolution. I have high resolution bathymetry data (25m) that I will resample to ...
20 views

### Overlay Shapefile and Raster layer in R [duplicate]

I have a raster layer with climate data from the north of Mexico, part of Canada and the US mainland. I am trying to restrict the climate data to only the zone of the US mainland. To do this I thought ...
62 views

### Is there a way to write single bands raster from multi-band layer faster in r?

I have 1000 multi-layer rasters and have to export each separate layer to a tif. Some friends recommended R to do the job. I used the following code: library(raster) namesVector<- c("layer1", ...
52 views

### How to batch generate thumbnails of raster layers with R?

I have been using R to maintain a rather large stack of raster layers (over 700 layers of data for sub-Saharan Africa). Each layer looks as follows ...
72 views

### Ecoregions shapefiles: subsetting, extracting and summarizing data from raster

I am attempting to subset and project an ecoregions shapefile from : EPA ECOREGIONS my data set is found here: SHAPEFILES and RASTER When I run this code, two major problems occur: 1) I cannot get the ...
27 views

### R equivalent of GRASS r.grow?

What is a good R equivalent of the GRASS function r.grow? The closest I've been able to find is the script suggested by whuber in response to Creating randomly shaped clumps of cells in a raster from ...
28 views

### glm with raster data: species decline~ ndvitrend

I have species decline data (number of population per year, over a period of 23 years) out of ndvi data for these 23 years I calculated the trend, and mapped it. now i'd like to relate the negative ...
21 views

### Finding the best way to prepare raster image for a function in R

I'd like to ask what is the best way to prepare big raster images in R to run a function on whole images. I have 30 tiff images with the size of ncol=12648, nrow=4144. I read them in R separately. ...
103 views

### Running Random Forest Classification on WorldViev-2 image in R - problem

I have a problem with performing RF in R for a WorldView-2 Scene. I've never ever before used R for remote sensing classification, so I simply followed what is written here. I've loaded scene (8-band ...
25 views

### In R, set NA cells in one raster where another raster has values

I have two rasters in R. I want to set values to NA in the first raster where the second raster has values. I think this should be simple, using the raster package, with two RasterLayer objects ...
33 views

### How to crop an image into more than 80 small sections automatically in R

I'd like to crop an image into 15 sections in R. The image projection is Geog lat/long, extending 87 to 120 degree in East and 45 to 55 degree in North. I want to separate it by every 2 degree. So I ...
31 views

### Analyse effect of groups on raster maps

I work with a mechanistic model that uses climate data to simulate some specific output for different time steps and spatial locations. Now I want to investigate the effect of different climate data ...
109 views

### Unserialize socklist error when using rasterEngine in r

Basically, I am running the "rasterEngine" function in R. I want to use parallelization to change values in a raster image (I have around 400 images that I need to work on). However, the rasterEngine ...
63 views

### How to open a raw binary raster in QGIS or R

I have a raw binary raster without a file ending, and no header file. I would like to open this in either QGIS or R and then convert to geotiff, but opening it seems to be a challenge. Here is a ...
43 views

### Point-sampling rasters using R? [duplicate]

I need to be able to sample many raster files (imported from GeoTIFFs) using a previously defined set of spatial points, using R. What's the best way to do this?
537 views

### Extract Raster from Raster using Polygon shapefile in R

I am new to R and using the raster package. I have a problem extracting polygons from an existing raster file. If I use extract(raster, poly_shape) function on the raster it always creates a list ...
55 views

### How to deal with empty corners in raster when calculating fragmentation index

I have clipped buffer area around coordinate from one big raster (forest cover). Such created raster was loaded in R where PatchStat function (library SDMTools) gives fragmentation index. After ...
126 views

### Converting shapefile to raster: Character attributes

I've got a shapefile that I would like to convert into a raster, but the trick is that the attribute I want a raster version of is character data. I'm familiar with geoprocessing using GDAL (in the ...
203 views

### R raster Package Moran's I interpretation

I am using raster package to calculate the local Moran's I . The example gives the range of Moran's I between - 1 to 2.47. On my own data I have see the value range -3.070423 - 7.228558 How can ...
134 views

### How can I conduct Geographically Weighted Analysis using an exponential decay function?

I have some points (representing 30 study sites) and I want to calculate the weighted mean of several variables (landscape layers) using a negative exponential decay (weights function) to give more ...
92 views

### Plot a Raster in R with white space for NA values

I want to produce a .png of a raster with background values plotted as white space. Below you can see the current state of the plot. As you can tell, the pixels which should contain NA values, ...
130 views

### R Raster package loop over pixels

I want to perform a trend analysis for each pixel over it's time dimension. Therefore I wrote a loop over each pixel doing the calculation but this is extremely slow. I am sure there must be a faster ...
202 views

### Per-pixel (statistical) calculations on a raster stack using GDAL

In R, it's relatively trivial to perform per pixel calculations based on a raster stack (e.g., get std.dev for each pixel on a 12 layer GeoTIFF). Unfortunately, the speed is less than desirable when ...
129 views

### How to reclassify only a part of a raster but keep the rest unchanged (ArcGIS or R)

I'm trying to reclassify only a certain part of a raster...not the entire raster. Here's the problem. I have a LULC raster of the entire US. There are some issues with the raster that I want to ...
57 views

### Dates are off when opening netcdf file in R

I have a netcdf file with the time dimension that goes from 12/2007 until 12/2010 with monthly time steps. I can see the correct dates in both arcgis and panoply. Panoply tells me this file is a ...