Questions tagged [r]

Statistical computing language and software environment.

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

Error in .local(x, ..., value) : unused argument (warn = FALSE) when trying to plot rasterdata

I am trying to plot some Sentinel 2 Tif Data. > library(raster) > > # Sentinel 2 Raster Data > S2_2017_05_B04 <- raster('C:/Users/leona/Desktop/S2/S2_2017_05_B04.tif') > ...
0 votes
1 answer
256 views

How can I load a very large raster (or portion of it) into R from an ArcGIS file geodatabase using R-Bridge (arcgisbinding)?

I have a large raster stored in an ArcGIS geodatabase (dimensions: 105,000x260,000) that I am trying to load in R. I have tried the following: library(arcgisbinding) arc.check_product() gdb <- &...
0 votes
0 answers
19 views

Converting sat_zenith_tn variable into geotiff file using R

I am trying to convert .nc file to geotiff file of Sentinel-3 data product. However, I know there is dimension difference between coords and sat_zenith_tn. and I got this error:- lst_warp = st_warp(...
2 votes
1 answer
973 views

How to divide LINESTRING spatial network into equal length segments using R/sf?

I'm working on a project to model car crashes within the municipality of Milan using different statistical methods. I have a big dataset of all geocoded car accidents that happenend within the ...
0 votes
1 answer
396 views

Transform sf multipolygon with 1 feature into sf multipolygon with 2 features for each non-intersecting polygon in R

I have an sf multipolygon made up of two non-intersecting polygons. They look like this: But my sf object is stored as a multipolygon with 1 feature, so I cannot evaluate the non-intersecting ...
3 votes
1 answer
721 views

terra R package functions error that file exists and needs overwrite=T

For the past 2 days I am trying to use the terra R package functions crop(), mask() and project() for simple spatial analyses. However, after 2-3 min of running each of the functions gives the same ...
3 votes
1 answer
654 views

Rendering three-composition raster map with ternary colormap using R

Say there are three raster maps, representing percentages of sand, silt and clay respectively. The three values for each cell are hence summed up to 1. I want to use one raster map to characterize the ...
0 votes
1 answer
728 views

tmap, tm_arrange, make maps of similar size

I am currently producing maps using R’s package tmap. My goal is to combine two maps in a single PDF, and I want the extent of each map to be the same. The first map zooms in a given country and shows ...
1 vote
1 answer
242 views

tmap interactive - missing values

I'm having some trouble trying to plot a raster in tmap. It has 14 unique classes and all of them display fine with tmap_mode("plot"). However when I set tmap_mode("view") some classes do not display ...
1 vote
1 answer
206 views

How to Merge Multiple SpatialPolygonsDataFrames output using for loop in R?

I am calculating shadow cast using Shadow Package in R studio. I have successfully generated shadow cast by the three objects with specific heights for one whole day for every hour. The output I get ...
0 votes
0 answers
50 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? ...
2 votes
1 answer
1k views

Cluster geometries that touch each other

I'm trying to cluster the geometries in a sf object that touch each other. For the moment I'm using the same approach that it's explained in the answer here, but the problem is that the same idea ...
0 votes
0 answers
49 views

When I install package spatstat R doesn't install it

My problem is that I have tried various times to install spatstat, but R never installs it. I get an error message which is attached (doesn't let me attach the image): > install.packages("...
1 vote
2 answers
75 views

Plotting SpatRaster objects changes the margin parameters in R, can I prevent this?

I'm not sure what exactly the culprit is (the SpatRaster class as such, or the size of the raster files, or what package is handling the plotting call — terra, I think), but I keep having this ...
0 votes
1 answer
2k views

Permission denied (GDAL error 4) when attempting to open folder using list.files

I'm new to R and using terra and cannot figure out this permission error. This exact code works on another researcher's computer, so I'm not sure why it's not working on my Rstudios. The folder and ...
0 votes
1 answer
63 views

Determining number of vertices in R

How can I determine the number of vertices in an object in R? (Similar question here: Extract number of vertices in each polygon in R, has not worked for me) I am trying to upload the National Burned ...
1 vote
2 answers
461 views

Rasterize points by 'most frequent' in R

I have a series of spatial data points that I want to convert to a raster using the R function rasterize. The data I want represented is a factor value, so I want to represent the most frequently ...
4 votes
3 answers
3k views

Dividing Polygon into parts which have equal area using R

I have a Multipolygon and want to split it into parts with an equal area. How can I do it using R? my data: pol <-readOGR("/Users/Desktop/test.shp") pol_wkt <- wicket::sp_convert(pol) ...
0 votes
1 answer
284 views

Extract coordinates out of list() in R (bbox) and get centroid of bbox

I have a data.frame with a column called geo. In this column, there are lists with coordinates that represent a bounding box. I would like to grab the coordinates that are inside each list and ...
1 vote
1 answer
181 views

Kriging with gstat and Gaussian model produces bad outputs

I am trying to produce kriging models from elevations points using the gstat package. I can fit models to the empirical variogram using exponential, spherical, and Gaussian curves. However, despite ...
0 votes
1 answer
37 views

How to resolve "Rscript not found" error when executing r.futures.potential in GRASS GIS?

I'm trying to run a Python simulation script in GRASS GIS 8.3.1 on Windows that utilizes the r.futures module. I get the following error when the r.futures.potential command is reached: ERROR: ...
0 votes
0 answers
32 views

Adding Map Layers using GGPLOT - Colorizing Adds Errors

I am doing a mapping project, that I thought would be rather simple in R. Using the Freedom House scores for freedom, I created a map that colorized each country by it's freedom score. Seemed simple ...
0 votes
1 answer
122 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 ...
1 vote
2 answers
1k views

How to join values from a R dataset to a shapefile of polygons I've created in QGIS?

I have a dataset where I have count data of sea turtles associated to different areas, for example in area 4 the divers saw 20 turtles. I want to display the column of counts on a shapefile I've ...
1 vote
1 answer
570 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
1 answer
63 views

Create heatmap polygons shapefile from a points shapefile for a variable in attribute table in R

The objective is to create heatmap polygons from a points shapefile named "df_sf" for an attribute "V1" in the shapefile and then export these polygons as another shapefile in R. ...
0 votes
0 answers
44 views

R sf package - upgrade PROJ

Using Rstudio, I need a projection that is not available in the PROJ version I have (see that question). > library(sf) Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE I would ...
-1 votes
1 answer
43 views

Doing high-fidelity trilateration in R [closed]

Is there a way to do high-fidelity trilateration in R (naturally, I'll be using latitudes and longitudes)? I'm not looking to solve a specific problem, but rather identify tools that are capable of ...
1 vote
1 answer
2k views

Transform CRS of Shapfile (sf) and Raster( raster)

I'm working with R. And to have a Rasterfile and a Shapefile. Now I want to fit their CRS/ EPSG so I can plot them together. Several approaches I've tried won't work. Someone may help? THE CRS/EPSG: ...
1 vote
1 answer
217 views

Can catalog_apply output a LAScatalog?

I am trying to use catalog_apply on a LAScatalog of 151 las tiles for my research. I have experimented with a catalog of 10 of these tiles, and with automerge = TRUE, the catalog_apply returns a huge ...
1 vote
1 answer
237 views

Shapefile licence agreement when publishing map made with R's maps package

I am submitting an article that has a map I made using R's data from R's maps package. I know that most shapefiles come with a license user-agreement or copyright information that accompanies the map ...
0 votes
1 answer
97 views

How do I reproject without an EPSG code?

I have a set of points that I need to project, but can't find the EPSG code. (EPSG have made it so easy I never had to work with non-built-in codes..) library(sf) Linking to GEOS 3.11.0, GDAL 3.5.3, ...
0 votes
1 answer
77 views

Rasterizing more than 11000 polygons in QGIS

I'm using QGIS 3.28.3. I have more than 11000 species ranges, which I want to transform into binary rasters (1 for species occurence, 0 for species non occurence), with one raster for each species. I ...
0 votes
1 answer
179 views

Use lookup table to create new raster layer based on values in multi-layer SpatRaster using R terra

I am doing an ecosystem classification project where I have 3 raster layers that each correspond to different ecological classes with different numbers of categories. I want to take the unique ...
0 votes
1 answer
78 views

R Leaflet map: set minimum radius size

I have an R Leaflet map showing cicles to mark the locations of industrial facilities. Some of these facilities have been assigned a risk score in the data ("RSEI_Score"), and others not (...
0 votes
1 answer
310 views

How to use remote openstreetmap osrm server for USA

How can I use a remote osrm server to calculate driving distances in the USA (or North America). If at all possible, I would really like to avoid having to set up my own local server. I am basing my ...
1 vote
1 answer
671 views

Can I access Worldclim 2.1 CMIP6 data in 30-second resolution?

I am trying to access the Worldclim 2.1 CMIP6 future climate data at 30-second resolution. The Worldclim website says 30-second data will be available by then end of March 2020. This is long overdue ...
1 vote
2 answers
263 views

Importing GEE feature collection output as sf object in R

When you export a feature collection (as a CSV) from Google Earth Engine, the geometry information is stored in WKT format under the variable .geo. The general format for each cell in the vector .geo ...
0 votes
1 answer
833 views

Error in gstat.formula.predict(d$formula, newdata, na.action = na.action, : NROW(locs) != NROW(X): this should not occur

I'm trying to perform regression kriging using the code creating variogram m <- vgm(var(soil$Ba), "Sph", sqrt(areaSpatialGrid(slope))/4, nugget=0) v <- fit.variogram(variogram(Ba~RASTERVALU, ...
1 vote
1 answer
66 views

Finding if presences are clustered in presence absence data

I think this is a geographic questions but if not please redirect my question to where it's more suitable. I'm working in R. I have a large dataset (500,00 to 13 million records depending on which ...
0 votes
1 answer
84 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 ...
1 vote
1 answer
73 views

Why are latitude not part of the UTM system?

I am trying to project long/lat coordinates to UTM in R (actually I have a script that works) but I'm curious about the zone argument. Here is the script I have. It uses the spTransformfunction from ...
0 votes
1 answer
27 views

How to plot tree tops and point cloud data in the same window using lidRviewer?

I'm following the steps in The lidRbook Chapter 7.1 to get tree tops. I want to plot the tree tops and point cloud data as illustrated in the book, however, I want to use lidRviewer as it runs much ...
1 vote
0 answers
62 views

From points to raster - how do I set a gaussian function with a cutoff

Context SMAP's user guide states: "We use Gaussian weighting to interpolate the L2B estimates onto the map grid with a search radius of approx. 45 km and a half-power radius of 30 km.". ...
1 vote
1 answer
922 views

R (gdistance): least cost path passing through and/or crossing cells with NA

Intro The 'gdistance' R package is really useful in calculating least-cost paths (hereafter LCP) between locations. I have successful used some published material (LINK) for my purposes. What I'd like ...
0 votes
1 answer
612 views

Modifying the TIFF's attribute table value with R

I use raster::raster("test.tiff", RAT = T) to read the file with the format of TIFF. The TIFF is derived from ArcGIS pro generating using Feature to Raster -> raster -> tiff. ArcGIS ...
3 votes
1 answer
1k views

runGdal returns "gdalinfo failed - unable to open" [...] ".hdf" file

I'm trying to use the function runGdalin R on a Mac and it seems that gdalinfo is not able to open the file. In the terminal, when I entered gdalinfo /MODIS/MCD12Q1.006/2009.01.01/MCD12Q1.A2009001....
0 votes
1 answer
518 views

Copernicus variables without CRS

I have a problem when import my NetCDF files in R. When I import .nc file which downloaded from Copernicus (CMIP6 product - Sea surface height above geoid - CanESM5-CanOE (Canada)), I use raster(), ...
1 vote
1 answer
985 views

Data extraction for time series, transform multiple netCDF files to spatRaster with terra in R

I would like to extract data from around 13,000 .nc files to create a time series of temperature global data in R. Each of my files contain a day worth of data of global SST (my variable of interest) ...
0 votes
1 answer
2k views

Extract values from Grib-files at several specific locations

I have got a GRIB file from ECMWF for a small area in the Antarctic. It contains hourly data for one month of multiple variables (eg. wind, seaicecover, sst etc.). I want to extract this data to .txt ...

1
3 4
5
6 7
118