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
7
votes
1 answer

How to add text to a specific/fixed location in rasterVis levelplot

In fact, this question is consist of two questions targeting the same behaviour. How can I add text (varies by each panel) to a fixed location in panel area? I'm aware of panel.text and latticeExtra::layer solution but it adds text using plotting…
Sezen
  • 447
  • 1
  • 5
  • 17
7
votes
3 answers

Fill Holes with Majority of Surrounding Values (Python)

I use Python and have an array with values 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 and np.nan as NoData. I want to fill all "nan" with a value. This value should be the majority of the surrounding values. For example: 1 1 1 1 1 1 n 1 2 2 1 3 3 2 1 1 3 2 3…
7
votes
1 answer

Change raster panel titles using levelplot

I'm using RasterVis and levelplot to make a trellis plot of some rasters. I am currently ok for most things but I would like to change the header for each panel from the filename to a chosen string (the filename is convoluted and long, i want to use…
Sam
  • 1,400
  • 13
  • 29
7
votes
3 answers

R plot background map from Geotiff with ggplot2

With the R base plot, I can plot any geotiff with the following command: library("raster") plot(raster("geo.tiff")) For example, downloading this data, I would do the follwing: setwd("C:/download") # same folder as the ZIP-File map <-…
Ratnanil
  • 1,641
  • 17
  • 43
7
votes
1 answer

Lattice full plot area

I want to delete R's default margin around the lattice plot. This means that I want to get rid of all the white spaces beyond the red rectangular. Here is the example: library (raster) library(rasterVis) f <- system.file("external/test.grd",…
Geo-sp
  • 1,704
  • 3
  • 19
  • 42
7
votes
2 answers

raster package: Lines around each cell

I want to have black lines around each cell of a raster. Below is the example data. I mean, instead of this frame/borderless cells I want this(cells with borders) How can I achieve this? library(raster) require(graphics) require(grDevices) …
Novice
  • 307
  • 2
  • 11
7
votes
6 answers

R raster package split image into multiples

I have an image as below. It is 2579*2388 pixels. Lets assume that it's bottom left corner is at 0,0. From that image I want to create multiple images as follows and save them in the working folder. Each image will have size of 100*100 pixels. Each…
user2543622
  • 5,760
  • 25
  • 91
  • 159
7
votes
1 answer

Add raster image to HDF5 file using h5py

I apologize if this is sort of a newbie question, but I am fairly new to Python and HDF5. I am using h5py, numpy, and Python 2.7. I have data from various files that need to be imported into one HDF5 file. The data from each file is to be stored…
pyguy
  • 73
  • 1
  • 4
7
votes
1 answer

Implementing a Paper.js spiral raster example on server-side

I am trying to draw a spiral raster example (link) on a server (running Node.js). However, I am facing an issue where my path is not displayed on the exported frame and I can only see the downloaded image. Probably a silly mistake on my side,…
dmee3
  • 304
  • 2
  • 11
7
votes
2 answers

How to extract values from rasterstack with xy coordinates?

I have a rasterstack (5 raster layers) that actually is a time series raster. r <- raster(nrow=20, ncol=200) s <- stack( sapply(1:5, function(i) setValues(r, rnorm(ncell(r), i, 3) )) ) s class : RasterStack dimensions : 20, 200, 4000, 5 …
Eddie
  • 783
  • 4
  • 12
  • 24
7
votes
1 answer

Stack raster in a loop

I need to stack some rasters in a loop like: for(month in 1:12){ . . . "some algorithm spiting out a raster called 'sm_esa'" sm_esa_stack<-stack(sm_esa) } In the end I'd like to create a stack with 12 layers (one month each). But my last line…
EDU
  • 267
  • 1
  • 5
  • 13
7
votes
2 answers

Select rasters in stack based on layer partial name match

I have a stack of rasters (one per species) and then I have a data frame with lat/long columns along with a species name. fls = list.files(pattern="median") s <- stack(fls) df<-c("x","y","species name") I want to be able to just select one raster…
Herman Toothrot
  • 1,463
  • 3
  • 23
  • 53
7
votes
1 answer

How to get RGB raster image with UTM coordinates

I have a three layer raster with red, green, and blue channel values in it. I can plot the image with raster::plotRGB, but I need to add axes with UTM coordinates. Coordinates can be added with axes=TRUE, but they are floating in space and look bad.…
klar
  • 146
  • 5
7
votes
1 answer

R - plotting multiple rasters using matrix layout

In R (Win64), I'm trying to plot a combination of raster images and histograms in a single plot window using the layout() command with a matrix defining the layout. Here's some sample code with simplified data: library(raster) r <- raster(ncols=5,…
David Roberts
  • 617
  • 1
  • 11
  • 23
6
votes
1 answer

Work with large raster mosaics in R without merging them to a single file (like lidR catalog)

The lidR package has a neat way to work with huge (pointcloud) datasets: The catalog function (doc here) avoids loading the dataset to memory and can treat mosaics [datasets that are spread across multiple (non-overlapping) tiles] as single dataset.…
Honeybear
  • 2,928
  • 2
  • 28
  • 47