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

Java BufferedImage, writing to underlying Raster, pixels are appearing offset in the final image

Apologies for thread necromancny, I've attempted to produce a cut down version for testing, it's available here https://www.dropbox.com/sh/y0wtlae37yltfz5/yRDSyKj2NY The largest part of the download is the 3 sample images in the src folder (2 of…
9
votes
1 answer

Saving array as Geotiff using rasterio

I have the following numpy array: supervised.shape (1270, 1847) I am trying to use the following code to save it to GeoTIFF using rasterio: with rasterio.open('/my/path/ReferenceRaster.tif') as src: ras_meta = src.profile with…
GCGM
  • 901
  • 1
  • 17
  • 38
9
votes
4 answers

Identifying overlap zones in R raster package

Package: raster Data: A rasterStack with 10 bands. Each of the bands contains an image area surrounded by NAs Bands are logical, i.e. "1" for image data and "0"/NA for surrounding area The "image areas" of each band do not align completely with…
Benjamin
  • 11,560
  • 13
  • 70
  • 119
9
votes
1 answer

R - Finding least cost path through raster image (maze)?

How can I find a non-linear path through raster image data? e.g., least cost algorithm? Starting and ending points are known and given as: Start point = (0,0) End point = (12,-5) For example, extract the approximate path of a winding river…
Brian D
  • 2,570
  • 1
  • 24
  • 43
9
votes
1 answer

Merge rasters of different extents, sum overlapping cell values in R

I am trying to merge rasterized polylines which have differing extents, in order to create a single surface indicating the number of times cells overlap. Due to computational constraints (given the size of my study area), I am unable to use extend…
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
4 answers

Image classification (raster stack) with random forest (package ranger)

I'm fitting a random forest using the R package ranger to classify a raster image. The prediction function produces an error and hereafter I provide a reproducible example. library(raster) library(nnet) library(ranger) data(iris) # put iris data…
Hugo
  • 357
  • 3
  • 10
9
votes
1 answer

gdal_calc amin fails when passing more than 23 input files

I've written an R function that calls gdal_calc.py to calculate the pixel-wise minimum value across a RasterStack (series of input raster files). I've done this because it's much faster than raster::min for large rasters. The function works well for…
jbaums
  • 27,115
  • 5
  • 79
  • 119
9
votes
2 answers

Plotting a raster with the color ramp diverging around zero

I am trying to plot a map with positive and negative values. All positive values should have red color while negative should have blue color and zero should have white just like in this sample plot with discrete colors Below is the code I'm…
code123
  • 2,082
  • 4
  • 30
  • 53
9
votes
1 answer

Raster image is off-center after fit-to-page zooming in Paper.js

I'm working on a Paper.js application that puts a raster (an image) in the view. Then it zooms to fit the image so that all of it is visible at one time. It's mostly working, but the image ends up offset, like this: When it should look more like…
Scotty H
  • 6,432
  • 6
  • 41
  • 94
9
votes
2 answers

How to rotate an image R raster

I have code below which saves an image to my pc. I would like to rotate that image by 45,90 and 135 degrees around its center (or bottom left hand corner) and then save as 3 different images. How could I do that? library(raster) r1 <-…
user2543622
  • 5,760
  • 25
  • 91
  • 159
9
votes
2 answers

Plot continuous raster data in binned classes with ggplot2 in R

I quite like the look and feel of ggplot2 and use them often to display raster data (e.g facetting over timesteps for time-varying precipitation fields is very useful). However, I'm still wondering whether it is easily possible to bin the continuous…
fabern
  • 318
  • 2
  • 10
9
votes
3 answers

How to write a raster with RAT factors in R raster package

I want writeRaster to write the RAT (raster attribute table) that I've built in R. I'm running R 3.0.1, raster 2.1-49, and rgdal 0.8-10. My input raster looks like this: r <-raster("F:/test.img") class : RasterLayer dimensions : 3, 3, 9 …
RichT
  • 304
  • 1
  • 3
  • 13
9
votes
4 answers

Calculating weighted polygon centroids in R

I need to calculate the centroids of a set of spatial zones based on a separate population grid dataset. Grateful for a steer on how to achieve this for the example below. Thanks in advance. require(raster) require(spdep) require(maptools) dat <-…
geotheory
  • 22,624
  • 29
  • 119
  • 196
9
votes
1 answer

gdalwarp too slow (compared to gdal_merge)

I have 70+ raster images in TIFF format that I am trying to merge. Originals can be found here: http://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/vfr/ After pre-processing (pct2rgb, gdalwarp individual charts, gdal_translate to…
user1667302
  • 593
  • 6
  • 15