Questions tagged [r-raster]

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

Other resources

Related tags

1217 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
24
votes
2 answers

Interactive plotting with R raster: values on mouseover

I'd like to do a small program in R for interactive visualization and modification of some raster datasets, seen as colored images. The user should open a file (from the terminal it's OK), plot it, select the points to edit with mouse clicks, and…
AF7
  • 3,160
  • 28
  • 63
19
votes
1 answer

R: Handling of sf objects in raster package

Previously I was using raster::crop and raster::mask with shapefiles of class Spatial*, read in using rgal::readOGR. I am just "upgrading" my scripts to use sf for reading and manipulating polygons. raster::crop raster::crop expects an 'extent'…
pat-s
  • 5,992
  • 1
  • 32
  • 60
18
votes
2 answers

R - convert SpatialLines into raster

In R, we can take a raster and turn it into a SpatialLinesDataFrame with the function rasterToCountour: library(raster) f <- system.file("external/test.grd", package="raster") r <- raster(f) x <- rasterToContour(r) class(x) [1]…
Rich Pauloo
  • 7,734
  • 4
  • 37
  • 69
15
votes
1 answer

Converting SpatVector to sf or sp

Is there a straightforward way to convert polygonal SpatVector class objects (from the terra library) to either simple features or SpatialPolygonsDataFrames? Thanks
Andrew Plowright
  • 455
  • 4
  • 11
12
votes
1 answer

How to extrapolate a raster using in R

I am trying to downscale climatic conditions using the methodology in this article using the R software. I am almost there, but I am missing a couple of steps Packages and data needed For this example I uploaded some data to the archive.org website…
Derek Corcoran
  • 3,930
  • 2
  • 25
  • 54
11
votes
2 answers

image raster R package - raster printing without background and border and legend

I am using raster function as shown on lines below. My last line produces some output. That output has a line that says dimensions : 240, 320, 76800 (nrow, ncol, ncell). I would like reprint that image but say only first 200 rows and first 300…
user2543622
  • 5,760
  • 25
  • 91
  • 159
10
votes
1 answer

calculate and plot vector field of an arbitrary rasterLayer

Problem statement: With ggquiver::geom_quiver() we can plot vector fields, provided we know x, y, xend, and yend. How can I calculate these parameters for an arbitrary RasterLayer of elevations? How can I ensure that the size of these arrows…
Rich Pauloo
  • 7,734
  • 4
  • 37
  • 69
10
votes
1 answer

Identify position of a click on a raster in leaflet, in R

I am plotting a large lat-lon NetCDF raster over an R leaflet map using shinydashboard. When I click on the map, a popup comes out and shows row, column, lat-lon position and value of the clicked raster point. (See reproducible code below) The…
AF7
  • 3,160
  • 28
  • 63
10
votes
2 answers

Sum nlayers of a rasterStack in R

I am working with daily observation of climate data organized in .nc files. I read them using the stack command of the raster package. Each file (corresponding to a year) is a RasterStack element with the following characteristics: class :…
Nemesi
  • 781
  • 3
  • 13
  • 29
9
votes
2 answers

time and geographical subset of netcdf raster stack or raster brick using R

For the following netcdf file with daily global sea surface temperatures for 2016, I'm trying to (i) subset temporally, (ii) subset geographically, (iii) then take long-term means for each pixel and create a basic plot. Link to file:…
Peter Houk
  • 107
  • 1
  • 2
  • 6
9
votes
1 answer

Spatial correlogram using the raster package

Dear Crowd Problem I tried to calculate a spatial correlogram with the packages nfc, pgirmess, SpatialPack and spdep. However, I was troubling to define the start and end-point of the distance. I'm only interested in the spatial autocorrelation at…
Benasso
  • 123
  • 5
9
votes
3 answers

If raster value NA search and extract the nearest non-NA pixel

On extracting values of a raster to points I find that I have several NA's, and rather than use a buffer and fun arguments of extract function, instead I'd like to extract the nearest non-NA Pixel to a point that overlaps NA. I am using the basic…
Joe
  • 347
  • 5
  • 20
8
votes
4 answers

R: Detect a "main" Path and remove or filter the GPS trace maybe using a kernel?

Is there a way to filter out those parts which don't belong to the main path? As you can see in the picture i would like to remove the crossed out part while keeping the main path. I already tried using zoo/rolling median but without success. I…
Andreas
  • 397
  • 4
  • 18
  • 37
8
votes
1 answer

Is there a way in R to plot a legend with two axes?

I would like to plot a legend with two axes. Specifically, I have combined two spatial objects that have been classified, the first showing intensity of an event and the second showing the probability of the event at that location. I want to create…
dee_2_dee
  • 81
  • 1
1
2 3
81 82