Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

Merging two multipolygon shapefiles and removing one of overlapping polygons using R

I have two shapefiles of digitized wildfires. Each shapefile has many polygons representing different fires. Each shapefile has an attribute field to denote the year of the fire. One shapefile covers ...
0
votes
1answer
17 views

Why does {terra} r library not have a mean method for the project function?

Why when using the terra::project function, is there no 'mean' or 'max' or 'min' etc method for how one raster is projected to another resolution and alignment? https://rdrr.io/github/rspatial/terra/...
-3
votes
0answers
16 views

Converting dataframe in R to Shapefile [closed]

How do I convert a file that is in a dataframe in R to a shapefile?
0
votes
1answer
19 views

Cannot coerce class to a data.frame

I'm using R to run a random forest to predict the distribution of sediment classes in a study area. I have a .csv of the locations where sediment has been sampled, and rasters of all my predictor ...
0
votes
0answers
13 views

Plot labels for spatial lines in parallel to them in R

So I have this shapefile filled with spatial lines, https://www.dropbox.com/s/6o9gtfjesvqz696/vias%20pecuarias%20andalucia.zip?dl=0 and this with polygons https://www.dropbox.com/s/olbje6ljh26pvwx/...
0
votes
0answers
18 views

Upstream and downstream segments from a point (R) [closed]

I have a question regarding the use of sfnetworks for river/stream analysis. I have a river network consisting of around 4155 segments of 100 m each. I have a DEM for the catchment and I'm trying to ...
0
votes
2answers
32 views

R: Get majority percentage after aggregation with modal function

I want to aggregate a raster using a majority filter (modal) and in addition to that, I want to have a layer in which every cell has the value of the majority percentage. For example: Pixel 1 has a ...
0
votes
0answers
18 views

Discrepancies in size of area for Brownian bridge model

I want to get the size of some animal tracks using a Brownian bridge movement model. However, I've noticed that when I combine my data into a single object the size of the area differs compared to ...
0
votes
2answers
34 views

Plot filtered patch sizes in R terra

I would like to plot patch sizes above a threshold in R terra. f=system.file("ex/elev.tif", package="terra") r=rast(f) x=app(r,function(x) ifelse(x< 400,NA,x)) y=patches(x) z=...
0
votes
2answers
16 views

get patch size in R terra

I would like to get the patch sizes in a R terra object, and then filter patches above a threshold. How do I get patch sizes in terra (and then filter)? The only output I see is patch ID (see plot). f ...
0
votes
0answers
31 views

Error in rasterFromXYZ(xyz = centroids[, c("lon", "lat", "id")], crs = WGS84) : y cell sizes are not regular

I'm trying to convert a csv file set of values into a raster but keep receiving the above error. #Set raster options to improve speed of calculation rasterOptions(tmptime = 4, progress = ...
-1
votes
0answers
28 views

Selection of neighboring buildings of different heights [closed]

I am working on a layer of buildings indicating the height of these. I am looking for a method that would allow me to select only contiguous (or neighboring) buildings of different heights (see 1 and ...
2
votes
0answers
50 views

Aggregate interpolated data at county level with R

The raw data is at the state level and I would like to go down to the county level. To do this, I first adjusted the data to county level and then interpolated it. The raw data on state level looks ...
1
vote
1answer
33 views

Buffers clipped to features used to create them

I'm trying to create an sf object of polygons which are buffer regions clipped to the polygons used to create the buffers. Using st_difference returns an sf object with all combinations of both sf ...
0
votes
0answers
21 views

Converting complex depth contours to polygons in sf and R

I have a large dataset of depth contours downloaded from an open database. At the time of writing, these contours appear to contain the best available continuous depth model for my region of interest. ...
1
vote
1answer
41 views

Counting points in polygon by time / attribute condition

I have two tables in different databases I cannot connect directly. Table A contains polygons of regions. Table B contains points with timestamps. I want to count the points in each polygon for a ...
1
vote
1answer
38 views

Reprojecting NetCDF naming data from rotated pole coordinate system to WGS84 in R

I am using data from UKCP Local Projections at 2.2km Resolution. The data does not have any stored coordinate reference system. However, the associated documentation explains that UKCP use rotated ...
2
votes
1answer
33 views

Create Function to a RasterStack

This is the function that I want to create: Erosivity_Factor = 1.74 * log[sum(montly²/annual)]+1.29 I have solved it using a loop: # Reproducible RasterStack with 12 layers Monlty<- stack(lapply(1:...
0
votes
0answers
15 views

Converting PRISMA hyperspectral data to GeoTiff with prismaread in R

I am currently trying to convert PRISMA hyperspectral data from it's native .he5 format to GeoTiff. I would like to retain all of the spectral bands in the final product. There is a wonderful R ...
0
votes
0answers
22 views

Getting response curves with cloglog output with dismo package

I know that MaxEnt now uses cloglog output as its default, and the corresponding R package maxnet does the same. It appears that dismo still uses logistic output as the default when plotting response ...
1
vote
1answer
28 views

Non-overlapping geometries from two different objects in R

I can select geometries that overlap from two objects (basic example): library(sf) # create a simple square sq <- rbind(c(3, 3), c(15, 3), c(15, 15), c(3, 15), c(3, 3)) %>% list %>% ...
1
vote
0answers
21 views

Get overlapping area between polygons by group rather than total area using the sf package in R?

I'm interested in calculating the area of overlap of different protected area types in a polygon I make of an animal's range using a Brownian Bridge. The shape files come from here https://www....
1
vote
0answers
22 views

R + Assign a cell overlapping two countries to the one with the largest surface area

Some cell overlap two countries. Example, in the picture, cell n°85376 overlap Lesotho and South Africa. I would like to identify the country that has the largest share of the columns values (Cereal,...
1
vote
0answers
18 views

OSRM Isochrone - straight/square edges

I am calculating 1 hour cycling distance using osrmIsochrone in R and Docker. I have noticed that the polygons have square/straight edges. (see below example) Increasing the res even to high values (...
1
vote
2answers
97 views

How to create when possible a rectangle in polygons with holes [duplicate]

I did not find a similar question on this site. Is there a way to automatically create a rectangular polygon of 500 square meters inside another polygon with rings using QGIS? (I have 28,000 polygons ...
1
vote
1answer
19 views

Cut smaller polygons out of larger ones in using R/sf

I've got a set of polygons containing overlapping geographical levels, both regions and cities. This is a simplified example: I want to cut the cities out of the regions. So in the example above, I ...
0
votes
1answer
22 views

Fix NetCDF dimensions of stars object

I downloaded some CMIP6 data from Copernicus data service and I believe the NetCDF file came with malformed dimension information. When I try to get the lon or lat dimensions (st_get_dimension_values) ...
0
votes
1answer
12 views

Set RasterStack and SpatialPolygonsDataFrame to same coordinate system in R

I have a shapefile of 8094 Italian municipalities which I imported into R as a SpatialPolygonsDataFrame using readOGR. When I plot this, I get the following map: I also have a RasterStack of global ...
0
votes
1answer
27 views

problem with list.files() in R

here you have my data https://www.eea.europa.eu/data-and-maps/data/corine-land-cover-accounting-layers. I downloaded "CLC2000 Accounting Layer " file and "CLC2018 Accounting Layer" ...
0
votes
1answer
32 views

How to extract forest cover type from Corine Land Cover raster in R

I'm working with Corine Land Cover Accounting Layers files called "CLC2018ACC_V2018_20.tif.ovr" and "CLC2000ACC_V2018_20.tif.ovr". My goal is to get both qualitative and ...
1
vote
1answer
45 views

Aggregate Fishnet's Cells into 10 cells by 10 cells grid

How can I generate an ID variable taking a different value for each 10 cells by 10 cells group in a raster? Below is my code, built from this example. In this example, each cell get an id (i.e., the ...
0
votes
0answers
43 views

Display view extent (footprint) from drone imagery in R

I'm trying to display drone footprint of drone images using the EXIF data from JPG files; I've found this plugin which QGIS Full motion video, which works for video files; the equations and functions ...
0
votes
1answer
43 views

NA outcome when running over() between a SpatialPoints and SpatialPolygonsDataFrame

I am having a problem when over() doesn't give a value but keep giving meNA for every field in the outcome data.frame. The aim is to have the counts of tardigrade occurrences in each biogeoregion. ...
0
votes
1answer
48 views

Export kriging plot as GeoTIFF

I have performed kriging and plotted it with ggplot, now I want to load the plot in QGIS. For that to work I need a GeoTIFF file of my plot. How do I convert my plot into a GeoTIFF file? EDIT: added ...
3
votes
0answers
65 views

Parallelizing calculations on large SF object in Windows environment

I have a large SF object, containing 1 km x 1 km grid cells, where I need to aggregate the area of polygons within the grid cells, i.e. grouping by grid cell, but also grouping by a second variable, ...
2
votes
1answer
34 views

Extracting intersection areas in R with threshold

I have two shapefiles. One contains distribution species maps(circle) and the other contains types of vegetation (A,B,C). I want to know what area of every vegetation contains which species. I tried ...
8
votes
2answers
220 views

Creating ellipse around line in 3D space using R

BACKGROUND: A similar question has been asked before, but not answered; see Creating ellipse around line in 3D space using PostGIS. I am a new user asking this question but hopefully with more details....
0
votes
0answers
26 views

How to mosaic multiple rasters (MODIS data) in R programming

I've four tiles of MOD16A2 dataset, I want to mosaic them using following script in R. filez <- list.files(path = getwd(), pattern = ".tif") r.list <- list() for(i in 1:...
2
votes
1answer
53 views

Divide spatial hexagon in equal areas (pies) in r

I have a grid of hexagons that is being used to create a model per hexagon. I would like for each hexagon to be divided into 3 or 6 equal areas so that I can use 2/3 of the hexagon total area to train ...
5
votes
3answers
98 views

Comparing two rasters, based on a complex set of rules

I am trying to compare two rasters, say A.tif and B.tif. Both correspond to river bed level changes under two different flow conditions. Now I want to produce a comparison raster having values based ...
1
vote
1answer
15 views

Substract one raster from another based on coordinates

As the title suggests im trying to substract the values of one Raster (r2) from another Raster (r1) based on the locations of points (GPS coordinates). To show my problem ive created 2 rasters and a ...
0
votes
0answers
31 views

Tmap: The shape only contains empty units

I am trying to plot layers based in queries with tmap, with something like: tm_shape(data%>% filter(column=="some_data")) But when the query returns an empty sf the following meassage ...
1
vote
1answer
18 views

Adding a column in a raster attribute table in R to make a categorical one

#Get the names of all the files with extension ".tif" of the folder files <- list.files("C:\\Users\\user\\Desktop\\RCP26_2020\\", pattern='.tif$', full.names=TRUE ) files ...
0
votes
0answers
36 views

How to use QGIS plugin algorithm from R

I'm trying to execute some processes from QGIS tools (3.16) from an script in R. I can see the basic algorithms by calling this: qgisprocess::qgis_algorithms() I'm trying to use the visibility:...
0
votes
1answer
25 views

Create sf points and then lines from 4 columns in a data.frame while staying in dplyr

So I have a data.frame like this: df = data.frame( x1 = runif(10, 10,11), y1 = runif(10, 47,48), y2 = runif(10, 11,12), y2 = runif(10, 48,49), name = sample(letters, 10)) And I want to ...
0
votes
0answers
45 views

Setting up Whitebox Tools for R

I ran into issues setting up Whitebox Tools for R. I installed the whitebox package, downloaded the Whitebox Tools and place them in the R folder in Documents. However, using the functions results in ...
2
votes
1answer
43 views

Extracting the attributes of one shapefile from the overlap of another using sf

I'm building a movement model with some animal tracking data using a Brownian bridge. I use the resultant shape to measure how much of it overlaps with protected areas in the region (https://www....
3
votes
2answers
43 views

Lines and pixels in DTM

I'm creating DTM from lidar data using lidR. I get vertical lines and a pixelated appearence in some areas. I've tried different algorithms (knnidw and tin). library(lidR) fil = '/home/bera/GIS/...
0
votes
2answers
33 views

How to work with an ESRI projection in R using sf?

I want to use the Africa Albers Equal Area Conic projection for some analyses on animal territories that span the African continent. https://epsg.io/102022 Unfortunately this has a ESRI code rather ...
0
votes
1answer
60 views

lidR installation

I'm trying to install R and lidR on Debian 11: Installed r-base-dev v 4.0.4-1 using Synaptics Starting R in terminal, and: install.packages("lidR", dependencies=TRUE) The install process ...

1
2 3 4 5
99