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

extract() data from raster with small polygons - rounded weights too small

Using R, I am trying to extract data from a raster layer using a polygon layer. The polygons are much smaller than the raster cells: Now I call extract() from raster library: a <- extract(raster, polygons, weights = TRUE, small = TRUE) a # ... #…
Tomas
  • 57,621
  • 49
  • 238
  • 373
8
votes
3 answers

what is a clockwise face in openGL

In back face culling you may either use the face normals to see if the face is pointing away from the camera of you may do some technique with if the triangle is drawn clock wise or counter clock wise. I am confused about this technique with the…
Dan Webster
  • 1,185
  • 1
  • 12
  • 27
8
votes
2 answers

Java getSubimage() outside of raster

I'm trying to take an image and store it in an array of 16x16 subimages. The image I am using is 512x512 pixels. However, while iterating through the loop, getSubimage() is stopped by a Raster exception. Here is the code: public class TileList…
Emily
  • 111
  • 1
  • 1
  • 8
8
votes
2 answers

sum a undetermined number of rasters with do.call and raster package

in the frame of soil mapping, I need to sum a undetermined number of rasters. I try to do it using the 'raster' package and the 'do.call' function. However, if the 'sum' function can sum up to many rasters, doing the same operation using do.call…
fstevens
  • 1,287
  • 1
  • 17
  • 28
7
votes
6 answers

Check if a file contains raster or vector elements? (pdf, eps, ai)

Is there a way to check if a file has raster elements in it? I would be interested to do this for the .pdf, .eps and .ai formats. If the file is only vector I am converting it to .svg and if it has some raster elements I have to convert it to .png…
Vladimir
  • 103
  • 1
  • 9
7
votes
3 answers

Terra equivalent for raster::stack()?

Basically the title. I know you can read in a folder of rasters with rast() but I just want to stack two rasters that are read in separately. Thanks
Nathaniel
  • 81
  • 1
  • 6
7
votes
2 answers

Add border to rasterImage

Here is a gradient color legend I created using rasterImage: colfunc <- colorRampPalette(c("red", "blue")) legend_image <- as.raster(matrix(colfunc(20), ncol=1)) plot.new() rasterImage(legend_image, 0.9, 0, 1, 1) lbsq <- seq.int(0, 1, l=5) …
Patrick
  • 1,057
  • 9
  • 23
7
votes
2 answers

GDAL Raster Output

I'm trying to create a .tif file using GDAL in python. It's creating a file, but saying "no preview available" whenever I browse to it. Right now, I'm just trying to get it to make a copy of the input file. Here's my…
Pat
  • 199
  • 1
  • 2
  • 7
7
votes
2 answers

r Raster ".self$finalize" error causing failure

I've been using the following function to clip raster's by sf polygons for at least a year without any issues, but have started running into trouble with it since updating to R 4.0.3 and the recent rgdal updates. When I run clip the first time, I…
Heymans
  • 128
  • 1
  • 9
7
votes
2 answers

pixel/array position to lat long gdal Python

I am trying to convert positions in a raster representing a .tif to the corresponding global coordinates. Converting the whole array to a tif and load it to QGIS everything is referenced fine, but using the below calculation method for single points…
niaR
  • 107
  • 1
  • 9
7
votes
1 answer

R: reading geotiff data straight from web url (httr::GET raw content)

I would like to create a RasterLayer from GeoTIFF data provided by a server. I'll query the server for this data using a httr::GET call (the data is provided on-demand, so in the application there won't be a url ending in .tif but a query…
7
votes
4 answers

Downloading SRTM data with raster package?

I'm trying to get SRTM data with "raster" package in R, but as soon as I'm choosing SRTM in getData command, I would get the following error: library(raster) srtm <- getData('SRTM', lon=16, lat=48) trying URL…
Haribo
  • 2,071
  • 17
  • 37
7
votes
1 answer

How to subset a raster based on grid cell values

My following question builds on the solution proposed by @jbaums on this post: Global Raster of geographic distances For the purpose of reproducing the example, I have a raster dataset of distances to the nearest coastline: library(rasterVis);…
fabfab
  • 83
  • 1
  • 1
  • 5
7
votes
1 answer

Calculating mean, median and standard deviation in stack raster for different time steps

I have a raster brick/stack (using the raster package) in R for 45 years of annual rainfall data from 1970 to 2015. I want to calculate mean, median and standard deviation for a given year e.g. 2015 using the last 5 years, 10 years, 15 years, 20…
user2807119
  • 333
  • 3
  • 4
  • 11
7
votes
1 answer

Avoid memory increase in foreach loop in R

I try to create summary statistics combining two different spatial data-sets: a big raster file and a polygon file. The idea is to get summary statistics of the raster values within each polygon. Since the raster is too big to process it at once, I…
joaoal
  • 1,892
  • 4
  • 19
  • 29