Questions tagged [raster]

A rectangular array of pixels. A Raster defines values for pixels occupying a particular rectangular area of the plane, not necessarily including (0, 0).

A rectangular array of pixels. A Raster defines values for pixels occupying a particular rectangular area of the plane, not necessarily including (0, 0).

3658 questions
52
votes
1 answer

How to make R's 'raster' package distinguish between positive and negative rotation matrices in GeoTIFFs?

It appears that the raster package in R doesn't distinguish between positive and negative rotations of GeoTIFFs. I have a feeling that it is because R is ignoring the negative signs in the rotation matrix. I'm not quite savvy enough to dig down…
Tedward
  • 1,652
  • 15
  • 19
50
votes
3 answers

How to set use ggplot2 to map a raster

I would like to make a plot using R studio similar to the one below (created in Arc Map) I have tried the following code: # data processing library(ggplot2) # spatial library(raster) library(rasterVis) library(rgdal) # test <-…
mr. cooper
  • 810
  • 1
  • 9
  • 15
47
votes
4 answers

What is the simplest RGB image format?

I am working in C on a physics experiment, Young's interference experiment and I made a program who prints to file a huge bunch of pixels: for (i=0; i < width*width; i++) { fwrite(hue(raster_matrix[i]), 1, 3, file); } Where hue, when given a…
Nope
  • 897
  • 1
  • 8
  • 15
36
votes
6 answers

How to change the resolution of a raster layer in R

I have several high resolution raster layers in R that I am working with. The level of detail is excessive for some of the analyses I am running, so I would like to speed things up by reducing the resolution. The coordinate system is UTM so the…
NRP
  • 503
  • 1
  • 4
  • 6
36
votes
7 answers

Merging multiple rasters in R

I've been trying to find a time-efficient way to merge multiple raster images in R. These are adjacent ASTER scenes from the southern Kilimanjaro region, and my target is to put them together to obtain one large image. This is what I got so far…
fdetsch
  • 5,239
  • 3
  • 30
  • 58
35
votes
3 answers

R: How to extract dates from a time series

How can I extract dates from a times series? Here is a time series: x = seq (1, 768) myts <- ts(x, start=1982, frequency=24) Originally I needed to create a vector holding date/time data for the rts function, The observations start 1982 with 2…
Liza
  • 1,066
  • 2
  • 16
  • 26
34
votes
2 answers

Clipping raster using shapefile in R, but keeping the geometry of the shapefile

I am using {raster} to clip (or crop) a raster based on an irregular shapefile (the Amazon biome) but the output always has a rectangular extent. However, I need the output in the exact same geometry of the shapefile. Any tips?…
ALSM
  • 627
  • 1
  • 5
  • 14
32
votes
3 answers

How to create a raster from a data frame in r?

I have a data frame in which values (l) are specified for Cartesian coordinates (x, y) as in the following minimal working example. set.seed(2013) df <- data.frame( x = rep( 0:1, each=2 ), y = rep( 0:1, 2), l =…
Gregory
  • 4,147
  • 7
  • 33
  • 44
30
votes
3 answers

Can R be used for GIS?

I'd like to create some GIS plots, and I'm wondering if R can be used for this. Here are some examples of plots I'd similar in concept to those I'd like to make: A temperature plot (or contour plot) of the United States, with color (or height)…
stretch44
  • 403
  • 5
  • 5
29
votes
4 answers

R: Write RasterStack and preserve layer names

I have a raster stack, stk, consisting of three raster images in R. Here is a simple example # set up a raster stack with three layers > library(raster) > r <- raster(nrows=10,ncols=10) > r[] <- rnorm(100) > stk <- stack(r,r,r) # layer names are…
kguay
  • 391
  • 1
  • 3
  • 7
26
votes
4 answers

Reading an ASC file into R

I'm currently trying to extract information from various "ASC" files into R in order to perform analysis on the data. The issue is that I am unsure of how exactly to read in the files. I attempted a standard read.table functions, but all the…
arifyali
  • 385
  • 1
  • 3
  • 6
23
votes
6 answers

How can I create raster plots with the same colour scale in R

I'm creating some maps from raster files using the "raster" package in R. I'd like to create comparison rasters, showing several maps side by side. It's important for this that the colour scales used are the same for all maps, regardless of the…
mo-seph
  • 6,073
  • 9
  • 34
  • 35
20
votes
3 answers

PROJ4 to PROJ6 upgrade and "Discarded datum" warnings

Context My questions are related to the changes induced by the upgrade from PROJ4 to PROJ6 and the consequences in various R spatial packages (sp, sf, raster). We receive now a lot of warnings about “Discarded datum” that looks a bit worrying and…
Gilles San Martin
  • 4,224
  • 1
  • 18
  • 31
19
votes
1 answer

Following HTML knit - RMarkdown including block of white space

I have working on journaling the visualization of some spatial data using Raster and RMarkdown, but am having a problem with there being a bunch of negative space above each figure. Here is the RMarkdown code (somewhat simplified): ```{r…
Patrick Williams
  • 694
  • 8
  • 22
19
votes
2 answers

ggplot2: raster plotting does not work as expected when setting alpha values

First post here, I hope I'm observing website etiquette. I couldn't find and answer on the site and I previously posted this to a ggplot2 specific group, but no solutions as yet. Basically I am trying to overlay two rasters using ggplot2 and…
Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
1
2 3
99 100