Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

stars and st_apply: summarise NetCDF for each timestamp and create multiple new attributes

I have a stars-object like this one: https://drive.google.com/file/d/1qcMATPjSyw-Rk9WpfFTa1rpr7dtOUxsu/view?usp=drive_link It looks like this: nc = read_stars("~/Desktop/SPARTACUS - Spatial ...
Lenn's user avatar
  • 1,379
1 vote
1 answer
53 views

Combining layer information from two different maps into another, separate map in R/terra

I am a bit new to geographic analyses, so apologies if I am not using 100% the correct terminology. I was hoping I could get some help on putting together different information layers on one map. I am ...
Tal's user avatar
  • 21
0 votes
1 answer
42 views

Read a .nc file and get variables at certain locations

I have two data files. One of them contains locations with certain spots. data_locs <- data.frame( Year = c(2000, 2001, 1993, 1993, 1994, 1995), Month = c(1, 1, 2, 9, 9, 9), Day = c(24, 22, 4,...
adrianmnc's user avatar
0 votes
1 answer
48 views

Error in terra::classify - Not compatible with requested type: [type=list; target=double]

I am trying to classify a spatRaster in a study area using terra::classify in three quantiles and I keep getting the message: Error: Not compatible with requested type: [type=list; target=double]. ...
Lays Viturino de Freitas's user avatar
1 vote
1 answer
77 views

Plotting discrete/categorical rasters with custom colors slows down R/terra

I've got a simple but frustrating problem. Here is an example raster (nothing huge, about 2 Mb): [file link] library(terra) continuous <- rast("example.tif") # Figure 1 plot(continuous) ...
Olle's user avatar
  • 167
1 vote
0 answers
19 views

How to create a transition matrix from 3 rasters using gdistance

I have a dummy raster nrows <- 4 ncols <- 7 ras <- raster(nrows = nrows, ncols = ncols) values(rast) <- 1:(nrows * ncols) And I have three rasters that represent the speed of going from a ...
dguerrero's user avatar
0 votes
1 answer
33 views

Plotting multiple customised rasters in a raster stack with colours already selected from viridis palette in R

Method I'm working with satellite AQUA MODIS Lm3 files for chlorophyll-a, sea surface temperatures and sea surface salinity, and I calculated depth, slope and rugosity from GEBCO files using the terra ...
Alice Hobbs's user avatar
0 votes
0 answers
51 views

Function to loop through multiple binned AQUA MODIS (NetCDF) files to create raster gridded data for chlorophyll-a in R

Issue I downloaded binned AQUA-MODIS netcdf files (total = 3422) for daily chlorophyll-a from the Earthdata website from 2012 to 2024 for The Northern Red Sea, Egypt. It is currently not possible to ...
Alice Hobbs's user avatar
1 vote
1 answer
48 views

Assigning Raster Values from TIFF File to Point Locations in R

I'm working on a spatial analysis project in R where I have two datasets: Village Dataset (village_data): Contains latitude and longitude coordinates for each village in India. Includes ...
Kiara 's user avatar
  • 11
0 votes
1 answer
33 views

randomPoints function not working on bioclim data

I want to use bioclim variables in my species distribution model but am having issues with the randomPoints function from dismo. I get the error: Error in randomPoints(bats_buff_final, 1000, bats_max)...
adkane's user avatar
  • 341
0 votes
0 answers
20 views

Raster does not appear rotated and does not match its footprint

I'm trying to georeference raster images to open them in ArcGIS Pro and make annotations. I've used the Oriented Imagery toolset in ArcGIS Pro to get the footprint of each image based on camera ...
Timelate's user avatar
  • 111
0 votes
1 answer
31 views

How to create monthly raster in such a way that it's pixel values are less than the next month?

I have two montly land surface temperature (LST) rasters from Landsat 8, for the months July and August. The LST values for August are slightly higher than the pixels values from the July raster. I ...
Nikos's user avatar
  • 1,167
1 vote
0 answers
34 views

Batch georeferencing of aerial imagery above the ocean using R

I am working with aerial imagery collected above open water. The raw images are not georeferenced. I am using the closest position recorded by the aircraft (based on timestamps) as the coordinate for ...
Timelate's user avatar
  • 111
0 votes
1 answer
82 views

Overlapping emmissions with Euclidean decay

I have a number of emission sources (roads) with varying emission values (noise). For the sake of simplicity, let's say the sources were 3 points. The emitting noise decreases by the inverse distance ...
Ratnanil's user avatar
  • 1,033
1 vote
2 answers
176 views

Cloud masking ECOSTRESS LST data

I have downloaded a land surface temperature (LST) raster from ECOSTRESS as well as it's associate cloud mask (you can sign-up for free here and download your own data). NASA's tutorial (minute 31:15) ...
Nikos's user avatar
  • 1,167
1 vote
1 answer
59 views

Raster extract function on R return values incompletely

I am using R to extract the raster values based on the grid (polygon). The result extracts the values but with some missing data (NA) in the output. These missing values are located on the ...
Cinnamon roll's user avatar
0 votes
1 answer
67 views

Error when using tmap: Error in if (hover != "" && !hover %in% smeta$vars) rlang::arg_match0(hover, : missing value where TRUE/FALSE needed

I am trying to make a map using the tmap package in R, because I have a continous raster for which I think using Jenks Nature Breaks would be usful for visualisation. Thus far this is what I have: ...
Birdman's user avatar
  • 97
0 votes
1 answer
70 views

Correlation analysis between large number of environmental rasters

I am trying to run a correlation test in R for 761 environmental rasters, but that seems to be too many to run at one time. For context, I have average monthly SST and CHL rasters over roughly 50 ...
Caroline Golightly's user avatar
0 votes
1 answer
130 views

Splitting and calculating across a large RasterStack using Terra in R

I have a rasterstack, created from an .nc file, named 'dat.stack' > dat.stack class : SpatRaster dimensions : 180, 360, 28896 (nrow, ncol, nlyr) resolution : 1, 1 (x, y) extent : -...
Beardedant's user avatar
1 vote
1 answer
108 views

"Latitude Grid Not Spaced Evenly" warning from NCEP-NCAR reanalysis 2m Air Temp raster

I am using air temperature data from the NCEP-NCAR reanalysis along with a country shape file to calculate mean air temperature by country. The NCEP-NCAR project has various air temperature rasters ...
hayfreed's user avatar
  • 123
0 votes
1 answer
44 views

How can I stop writeRaster from changing the extent of processed raster data?

I need to align raster data from several files. To do this I am using a for loop as shown below. As a check I print the extent of each of the rasters before calling writeRaster() to write the aligned ...
Schalk Malan's user avatar
1 vote
1 answer
95 views

Create / adjust plot to raster extent - R Studio

This probably a fairly simple fix but have not managed to find a solution, being really new to R. I have imported a canopy height model raster into R and done basic plotting of the raster chm <- ...
HSF's user avatar
  • 23
1 vote
1 answer
34 views

Calculate asymmetric raster-cell neighborhood statistic in R

Statistics for an asymmetric raster-cell neighborhood are required. The application is modelling direct solar insolation over year-long time steps while accounting for local shading effects of ...
Eron Raines's user avatar
0 votes
1 answer
131 views

Unable to ‘writeRaster’ for signature ‘"SpatRaster", "missing"’

I'm trying to modify a CHELSA raster (download here [205MB download]) to fill the NA values in it, such as require(terra) require(raster) file = "~/Downloads/CHELSA_bio14_2041-2070_gfdl-...
Tristan's user avatar
  • 113
0 votes
0 answers
139 views

In R: raster:brick() read NetCDF file for one location produces error: cells are not equally spaced

I wrote a script to download SST data as NetCDF and convert it to a data.frame in R. I use raster::brick() to read the data and convert it with raster::as.data.frame(xy = T) to a data.frame. If I do ...
OnLeRo's user avatar
  • 73
0 votes
2 answers
73 views

Using a raster when it is 'the output is a list of SpatRaster objects'

I am trying to make a set of rasters/maps with pixel level heterogeneity calculations using the R package 'rasterdiv'. I'd then like to look at the resulting maps in QGIS, presumably meaning I'd need ...
willbutdontwanna's user avatar
1 vote
2 answers
69 views

Extract adjacent raster pixels file

I have two burned area raster files in R. I want to find and extract the pixels spatially connected to the previous year's burned area. Hereafter, I want to extract all the pixels spatially connected ...
Thomas's user avatar
  • 917
3 votes
1 answer
202 views

Expanding the extent of a raster while keeping original cell values

Due to the type of models I'm running, I need to expand my rasters beyond their original extent. For example, my raster has ext(original_raster) SpatExtent : -2700100, 2750900, -2500900, 3342100 (xmin,...
gkoerich's user avatar
1 vote
3 answers
405 views

Convert vector data to terra raster where vector points are center of tiles with irregular grid

I would think there should be a simple solution to this, but I can't figure it out. I have a csv file with the following data wealth_data <- read.csv(text ="latitude,longitude,rwi,error -2....
Cannon's user avatar
  • 113
0 votes
1 answer
78 views

How to reference many raster layers in the lapp function of {terra} in R

I am attempting to create rasters with estimates of extraterrestrial radiation as outlined by the FAO Irrigation and Drainage paper 56. It only depends on julian day and latitude, and its calculation ...
thiagoveloso's user avatar
0 votes
0 answers
16 views

Error to generate regular raster stack time series in R using bfastts

I try to convert regular time series raster stack using bfastts function in bfast model in R. When I can generate a time series for 1 pixel (s in the example). However, I cannot generate time series ...
user30985's user avatar
  • 379
0 votes
0 answers
53 views

"Object which.column not found" when reading in land-cover dataset with stars (R)

I'm not sure where the problem lies--in R, a quirk of the dataset, my own computer? The dataset in question is a raster dataset of land cover in the United States. It's linked from the MRLC, but for ...
John Reaves's user avatar
0 votes
0 answers
109 views

Creating a new layer from raster attribute table in R with terra?

Say I have a raster with a raster attribute table: library(terra) r <- rast("whateverfilepath.tif") rat <- levels(r) I would like to create a new layer based upon a value from the ...
Reid L's user avatar
  • 1
0 votes
1 answer
596 views

Extract time series subset from NetCDF for many spatial points using R [closed]

I have been following mdsumner's response on Extract time series from .nc files for many locations simultaneously which is a similar question, but am having some trouble. Here is my code: library(...
Hailey's user avatar
  • 3
1 vote
0 answers
67 views

Rasterization of polygons - area covered different categories

I have a Shapefile of habitat type across Great Britain - I have split this large Shapefile into smaller categories by filtering in R. For each of these smaller categories I used the coverage_fraction ...
user240308's user avatar
2 votes
1 answer
174 views

Trying to create buffer around buildings, but terra::buffer fails for larger rasters

I'm trying to create a raster with info on whether or not each point is near a building. To this end, I'm starting with a geotagged raster that contains the locations of buildings (resolution 10 ...
Olle's user avatar
  • 167
1 vote
1 answer
57 views

Are there alternatives to this construction of a minimum spanning tree of a raster for the SKATER algorithm?

This could be seen as a continuation of this question where the top accepted answer uses the spedp library in R in order to generate contiguous clusters of a raster image with multivariate data. In ...
Phil's user avatar
  • 23
1 vote
3 answers
349 views

R: Error Data is too long

I have a R Script, that is extracting some information from a dem Raster through a multiprocess step. At one Point the standart deviation of the raster is calculated: std_ras <- sd(ras_smooth[], na....
Pradakasten's user avatar
1 vote
1 answer
182 views

Create copies of rasters in R via GDAL

I am looking for an efficient way to create copies of rasters in R via GDAL. Since the advantages of such an approach might not be directly obvious, here is some more context. Via GDAL we can read ...
darius.goergen's user avatar
0 votes
1 answer
184 views

Some polygons are loading incorrectly as terra SpatVect but not SpatialPolygonsDataFrames

I am seeing an issue with some polygon features loading incorrectly as terra SpatVectors. I cannot replicate this issue yet, but here is an example polygon as an rds on Google Drive. If I load this ....
Scott Z's user avatar
  • 141
0 votes
0 answers
338 views

terra::project seems to be changing the values of a raster

I am trying to calculate the proportion of a land use category in R just like it's explained here: Calculating continuous raster representing land cover proportion from categorical raster using QGIS? ...
c roc's user avatar
  • 29
0 votes
1 answer
794 views

Clipping sf vector by terra raster extent with R

I am trying to do something fairly simple: I want to clip a vector with point features down to only features that are contained within a raster extent. For raster I am using the package terra, for ...
Honeybear's user avatar
  • 2,554
0 votes
0 answers
74 views

Using 'rasterize' to create raster of overlapping polygons

I have found similar questions, but most use different packages. I have a shapefile with 20 multipolygons, with a few attributes. All I want is to create a raster whereby each raster cell's value is ...
Beardedant's user avatar
0 votes
1 answer
150 views

lidR: Writing output from pixel_metrics() from "multiple-output-function" to separate raster files

First some background from the original question: I'm using the lidR package to make rasters of metrics calculated on point clouds. I have a custom function that calculates 9 metrics outputed as a ...
Martin Stjernman's user avatar
0 votes
1 answer
74 views

Rotate stars raster object around the centroid in st_geotransform

I'd like to use an affine transformation to translate and rotate a stars object around the centroid. As far as I understand, the general approach is to i) translate the object so that the centroid ...
Thomas Moore's user avatar
0 votes
0 answers
65 views

How to make a list of pixels which intersect with my points?

I have: a series of rasters which are cut to the same dimensions with the same resolution (1km by 1 km). I also have a series of points of bird observations. I want to create a data frame which ...
PowellHall's user avatar
0 votes
1 answer
79 views

Processing S4 object of data class .MultipleRasterData

I downloaded ERA5 single level data using Python, where I tried to calculate daily_means from hourly data prior to downloading. I read the returned NetCDF-file into R using: nc_file <- "path/...
Zunka's user avatar
  • 1
0 votes
1 answer
137 views

Raster values in R lacking decimals

I am trying to get raster values from several layers from CHELSA climatic data. Here you can download one of them [https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/1981-...
jcasado94's user avatar
0 votes
2 answers
64 views

World Settlement Footprint - Binary variable changing to continuous variable after coordinate referencing system change

I am working with World Settlement Footprint data from 2019, which uses Sentinel data to create a binary mask of settlement area (=255 if settlement, =0 otherwise). I encountered a strange result when ...
Obleo Demandre's user avatar
0 votes
1 answer
159 views

Categorical land use raster to continuous values raster in R

I would like to transform categorical land use rasters from ESA CCI (http://maps.elie.ucl.ac.be/CCI/viewer/download.php) to rasters with continuous values. The crs is lon/lat WGS 84 and I would like ...
c roc's user avatar
  • 29

1
2 3 4 5
36