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
18
votes
4 answers

Identify a linear feature on a raster map and return a linear shape object using R

I would like to identify linear features, such as roads and rivers, on raster maps and convert them to a linear spatial object (SpatialLines class) using R. The raster and sp packages can be used to convert features from rasters to polygon vector…
digitalmaps
  • 2,885
  • 3
  • 22
  • 28
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
18
votes
5 answers

How to Replace Raster Values Less than 0 to NA in R code

I am working with Landsat imagery to calculate net radiation. There are very low negative values (ex: -0.000003) that are in my converted reflectance raster layers. I want to make sure that my reflectances are 0 - 1 in order to reduce error in my…
MaeAntoinette
  • 183
  • 1
  • 1
  • 7
18
votes
2 answers

How to remove the box frame in "plot.raster" in R package "raster"

I need to remove the box frame around the figure in R package "raster", but I cannot figure out which argument I should change. The example is as follows: library(raster) r <- raster(nrows=10, ncols=10) r <- setValues(r,…
Jian Zhang
  • 1,173
  • 5
  • 15
  • 20
17
votes
1 answer

Stitch images and data from coupled microscopy/spectroscopy into panoramic in Photoshop or R

I have a set of images and X-ray data generated from coupled scanning electron microscopy and energy dispersive spectroscopy. Here's my problem: I imaged transects of a rock surface like this (purple box outlines transect region): I wanted really…
Caitlin
  • 505
  • 2
  • 14
17
votes
2 answers

How to save figures to pdf as raster images in matplotlib

I have some complex graphs made using matplotlib. Saving them to a pdf using the savefig command uses a vector format, and the pdf takes ages to open. Is there any way to save the figure to pdf as a raster image to get around this problem?
geometrikal
  • 3,195
  • 2
  • 29
  • 40
17
votes
2 answers

How to project and resample a grid to match another grid with GDAL python?

Clarification: I somehow left out the key aspect: not using os.system or subprocess - just the python API. I'm trying to convert a section of a NOAA GTX offset grid for vertical datum transformations and not totally following how to do this in GDAL…
Kurt Schwehr
  • 2,638
  • 3
  • 24
  • 41
16
votes
2 answers

How to replace NA's in a raster object

I need to replace the NA's in the raster object (r) from the example below. library(raster) filename <- system.file("external/test.grd", package="raster") r <- raster(filename) I also tried to remove these these (and place the result in a…
ils
  • 473
  • 2
  • 4
  • 9
14
votes
1 answer

Preferred Vector Image format for use in WPF?

As per the title, what's the preferred image format (or formats) for use in WPF? My company will hire a designer to design some logos, images, toolbar icons, etc. for use in a WPF application. I was going to ask for Vector Graphics as they are…
joedotnot
  • 4,810
  • 8
  • 59
  • 91
14
votes
4 answers

Pixel by pixel Bézier Curve

The quadratic/cubic bézier curve code I find via google mostly works by subdividing the line into a series of points and connects them with straight lines. The rasterization happens in the line algorithm, not in the bézier one. Algorithms like…
nebuch
  • 6,475
  • 4
  • 20
  • 39
13
votes
4 answers

Overlay raster plot using plot(...,add=T) leads to arbitrary misalignment of final plot

I have found that when I try to overlay multiple rasters using plot(...,add=T) if I try to overlay more than 3 rasters together the subsequent plot does not align the rasters properly. My original intent was to create a categorical map of modeled…
Lucas Fortini
  • 2,420
  • 15
  • 26
13
votes
2 answers

Legend of a raster map with categorical data

I would like to plot a raster containing 4 different values (1) with a categorical text legend describing the categories such as 2 but with colour boxes: I've tried using legend such as : legend( 1,-20,legend = c("land","ocean/lake", "rivers","water…
Wraf
  • 747
  • 2
  • 10
  • 24
13
votes
3 answers

extract RGB channels from a jpeg image in R

In order to classify a jpeg image in R, I would like to get the RGB values of each pixel. My question: Is there a way to extract RGB channels from a jpeg image in R ?
DJack
  • 4,850
  • 3
  • 21
  • 45
12
votes
1 answer

Plotting a raster behind a shapefile

How can I plot a "raster" object behind a shapefile object? Both plot fine on their own but the points don't plot over the raster: require(rgdal) require(maptools) require(raster) myproj = "+proj=utm +zone=12 +north +ellps=WGS84 +units=m" shp =…
Benjamin
  • 11,560
  • 13
  • 70
  • 119
12
votes
4 answers

raster package taking all hard drive

I am processing a time series of rasters (modis ndvi imagery) to calculate average and st.deviation of the series. Each yearly series is composed of 23 ndvi.tif images, each of 508Mb, so total is a big 11Gb to process. Below is the script for one…
user2942623
  • 559
  • 5
  • 8