Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 21692

Raster is a data format consisting of regular grids of values, usually stored in an image-like format.

0 votes
2 answers
1k views

Extract longitudinal pixel values from raster.list, save to data frame

To further analyses, I need to extract the values over time per every pixel, and store it in data frame, where row = #pixel, column = year Dummy data: library(raster) # create raster data from scratch … # create empty raster y1<-raster(ncol = 3, nrow = 3) values(y1)<-1:9 projection(y1)<-CRS("+init=epsg:4326") # create and diversify the rasters y2<-y1+10 y3<-y1+20 y4<-y1+30 # make list of rasters …
maycca's user avatar
  • 3,386
0 votes
Accepted

Extract longitudinal pixel values from raster.list, save to data frame

the whole script: library(raster) # create raster data from scratch # create empty raster y1<-raster(ncol = 3, nrow = 3) values(y1)<-1:9 projection(y1)<-CRS("+init=epsg:4326") # recreate and diversify … the rasters y2<-y1+10 y3<-y1+20 y4<-y1+30 # create raster stack # create raster stack s<-stack(y1, y2, y3, y4) # plot rasters plot(s) # extract raster values - return a matrix of values in each pixel …
maycca's user avatar
  • 3,386
1 vote
1 answer
230 views

Subsetting single raster from raster list using ArcPy?

How can I subset only one raster of the raster list? The goal is to make a new list, but containing only one raster file. … created but for raster in myRasters: print raster # this is obviously wrong r _ 1 …
maycca's user avatar
  • 3,386
4 votes
3 answers
10k views

Save rasters created by loop operation to different directory?

For one raster it is easy: writeRaster(raster1, filename="raster1.img", format="HFA", overwrite=TRUE) script for my loops: # read files setwd("D:/Data/LANDSAT") library(raster) library(rgdal) # read … )){ rast.list[i] <-raster(raster_data[i])} # get extent of smaller raster e<-extent(a) # crop larger raster to smaller raster - it create rectangle object crop.list<-list() for(i in 1:length(rast.list …
maycca's user avatar
  • 3,386
7 votes
2 answers
11k views

How to write every raster from a list of rasters?

Now I would like to write every created raster from "norm" (containing 1 layer) into one raster, having its specific name. … Or, how to automatically write and save all rasters from raster list? …
maycca's user avatar
  • 3,386
1 vote
1 answer
898 views

Export of group = multiband raster to another format not works in GRASS

: r.in.gdal Create "group" = multiband raster from singleband rasters: i.group. … Export multiband raster as new format: r.out.gdal My problem is why when I use i.group I see that actually I have a group of my bands: but if I want to export group of my layers a see only single …
maycca's user avatar
  • 3,386
0 votes
1 answer
226 views

Classify integer raster in tmap

I want to plot a raster of the forest cover accross Europe using tmap::tm_raster(). … The raster data are available here: If I plot it, this is what I get: # Read raster data: forest <- raster("eea_r_3035_100_m_forest-area-2015_p_2015_v1_r1.tif", NAvalue = 65535) # Plot data: tm_shape …
maycca's user avatar
  • 3,386
1 vote

How to rasterize a vector dataset in R?

Here is a new package fasterize to speed up the conversion between polygons (here using sf object) to raster. … From the polygon first you need to create normal raster to define desired resolution, and than fill in values from polygon. …
maycca's user avatar
  • 3,386
1 vote

How to speed up raster to polygon conversion in R?

quiet) return(shp) } return(NULL) } make raster polygonization on dummy raster - the way you define the path may be different on R, RStudio and R from Terminal !! … (at least on OSX 10.9.5) # read raster r5<-raster("r5.img") plot(r5) # in R + RStudio: define whole path where to find gdal_polygonize.py !! …
maycca's user avatar
  • 3,386
1 vote

Function (sample code) to extract raster value per polygon in R

First convert raster and vector to terra format, and then run extraction by terra::extract(raster, polygon). … Note, that the output here is not a raster (unlike to QGIS or ArcGIS extraction) but a dataframe. …
maycca's user avatar
  • 3,386
1 vote

Can I find out the exact areas which each category covers?

I am not sure how much are you familial with R, but I think there is the best and very simple solution of your problem: library(raster) # read "raster" library setwd("D:/Data/.... … ") # set you working directory r<-raster("your_raster.tif") # import your category raster file t<-freq(r) # Calculate your raster frequency table - …
maycca's user avatar
  • 3,386
0 votes
Accepted

Unique value symbology not loading although values exist in ArcGIS raster attribute table?

My problem consisted in a fact, that I had two fields in the attribute table with same alias: gridcode. (even if the Field names were different: gridcode and gridcode_1) When I have modified the ali …
maycca's user avatar
  • 3,386
2 votes
1 answer
2k views

Simplify raster size to plot using ggplot geom_raster()

Underneath the vector data, I wanted to place the raster showing extends of forests over Europe, available here. The raster size of disk is 150 MB, has dimension of 46000 and 65000. … How to make sure that I can plot my raster with vector data using ggplot2? …
maycca's user avatar
  • 3,386
10 votes
1 answer
8k views

Importing multiple stacked raster images in R?

.*.img$") # read files as rasters s <- stack(raster_data) # check my imported rasters p.ex. raster n°8 from "s" raster stack s[[8]] and my raster s[[8]] contain only 1 layer, so not the whole …
maycca's user avatar
  • 3,386
1 vote
0 answers
522 views

R: how to export my Kriging result to raster? [duplicate]

I want to export results of my Kriging calculation to raster or some other format. … For second part, I imagine just to use raster::intersect(krig, SPDF). But how to get raster data for my Kriging? …
maycca's user avatar
  • 3,386

15 30 50 per page