All Questions
95
questions
1
vote
2
answers
92
views
R: Weighted mean is 0 for buffers that have no data
I am a newbie at R and am having trouble figuring this issue out so any help would be appreciated.
I have daily flooding raster data that I am using to calculate the weighted mean of flooding in ...
1
vote
0
answers
46
views
Error to installing the library of FIELDimageR
I am trying to install the FIELDimageR library, I follow the recommendations indicated on Github, I have tried to install it in the three ways indicated in the install section:
form 1
install.packages(...
1
vote
1
answer
179
views
Sampling based on polygon size/area
I am trying to sample about 10000 points in multipolygon (12) with different sizes. The multipolygon has "ID" and "Area". I want the sample to be drawn based on each polygon size (...
0
votes
1
answer
375
views
Creating 1m, 5m, 10m, 50m, 100m and 500m grids with OS National Grid codes in R
I previously asked this question on how to add OS National Grid codes to grids 1km and above. However, I now need a method of creating grids below 1km (1m, 5m, 10m, 50m, 100m and 500m) that have OS ...
0
votes
2
answers
160
views
subset raster to separate two classes
I have a raster that is too large to post here but can be downloaded from here: https://login.filesanywhere.com/fs/v.aspx?v=8c6c688b586472bcab6a . When I plot it I see a mix of water and land. I would ...
0
votes
1
answer
417
views
convert asc to raster with sf
I don't have an asc file handy right now for a reproducible example. I want to be able to read an asc file into R and then convert it to raster using the sf package. How can I accomplish that in R?
...
0
votes
1
answer
484
views
Calculate distance between point and nearest raster cell edge in R
I'm trying to calculate the distance in meters between a point feature and the edge of the nearest 30 x 30 meter raster cell. The data I have are aggregated by quarters for five years (2016-2020), so ...
0
votes
0
answers
66
views
Extracting pixel values based on condition
I have one raster file on land cover (30x30m pixels), one raster file on soil organic carbon (SOC) (250x250m pixels), and one vector file with contiguous polygons of different sizes.
What I require is ...
0
votes
3
answers
94
views
Jaccard index: R not letting me convert raster to numeric?
I'm trying to calculate the Jaccard index for my data, which is for two presence/absence rasters (of two different species). I also have a third raster, that contains the overlap of the species ranges....
2
votes
0
answers
61
views
Parallelizing nested lapply
How best can I parallelize this? year_ras is a spatRaster while sh_fields_base is an sf object.
yearStats <- lapply(year_list, function(year){
year_ras <- terra::rast(paste0(datadir, "/...
0
votes
1
answer
251
views
Extract raster values using circular buffer and a custom function
I'd like to calculate the percentual 1´s presence in a binomial raster using circular
area using a sf object (buffer arond points). I have tried to use the extract function but I am not able to create
...
0
votes
1
answer
278
views
R: Inserting a geom_sf layer on top of another geom_sf layer
I would like to plot a map of France using geom_sf and then add a layer to map Germany.
Here's what I did
library(ggplot2)
library(sf)
library(raster)
fr_sf = st_as_sf(getData("GADM",...
1
vote
2
answers
1k
views
calculate distance of points to polygon boundary using terra package in R
I am trying to calculate distance of points within a country to country boundary
library(terra)
library(geodata)
library(ggplot2)
library(geodata)
# get a shapefile of a country
gabon <- geodata::...
1
vote
2
answers
326
views
select raster within a specified distance from polygon boundary
I want to select raster cells that are within a certain distance (for e.g. 1 km or 5 km) from the boundary of a polygon. I ultimately want to take an average of only those raster cells that are within ...
1
vote
1
answer
2k
views
Dealing with raster data in ggplot
I have a vector spatial data for the boundary of a county and topographical data for the same county in raster format.
I need to create a map with ggplot so that it only shows those data in raster ...