Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

Statistical computing language and software environment.

-2
votes
0answers
18 views

Mutiple markers per single lat, long and curving polylines

1)I am plotting transfers from Facility A to Hospital. As such most the facilities have multiple transfers to different hospitals and different hospitals receive transfers from many facilities leading ...
0
votes
1answer
31 views

Land Cover Change Classification in R

I have two Land Cover (LC) classification raster over the same area and the same cell size. One from the year 2018 and the other from the year 2014. Both raster are classified with the values 1 - 6, ...
0
votes
1answer
56 views

Counting number of polygons within polygons using R?

I have two huge shapefiles. One contains polygons of one kind of vegetation and the other one representing a grid. A situation as follows but, of course, much bigger: I need: the efficient way to ...
-1
votes
0answers
34 views

Count number of polygons and area in shapefile and convert into raster using R [on hold]

I have a shapefile containing polygons of many buildings. I would like to count how many buildings are there and what is the total area of the buildings per 1km^2, and save/convert these data into a ...
0
votes
0answers
16 views

tmap::tm_facets() in interactive mode in html R Markdown file, small multiples variable title renders in wrong place

If you look at this reproducible snippet, when knitting, the first small multiples set renders both its and the next small multiples' title variable in the first set of maps. Here's the reproducible ...
1
vote
0answers
23 views

Creating decision rules on pixel level in time series layer in R? [on hold]

I am using Landsat 5, 7, 8 images and RStudio. My goal is to compute the disturbance in a given area using the Vegetation Change Tracker (VCT) algorithm. I would like to ask you if you could provide ...
0
votes
1answer
23 views

dist2Line - Error in dist2Line(…) could not find the function “dist2Line”

I have a csv file with points (about 20 millions georeferenced points) and a line shapefile. I want to find for each point the closest distance to the line. The line is not a straight line it's ...
1
vote
1answer
17 views

r raster: unique returns duplicated values?

I am using function unique() in package raster. I expect it to return the unique values for each layer, yet I get duplicated values... is that the expected result, or is there an issue somewhere? ...
2
votes
2answers
66 views

Plotting spatial points data in R?

I have some kind of noob question: how do I plot spatialpoints dataframe in R using spplot (or ggmap) based on column values? let's say we have this: library(sp) data(meuse) v <- ...
1
vote
0answers
16 views

R process: Zonal Stat Raster has No Data Values vs Arc output

I am trying to re-create my ArcGIS Zonal Stat model with R All my files will be 30m pixels; 18000 x 18000. I have used R two different ways to create the output and both create NoData values in the ...
0
votes
1answer
13 views

Subset raster stack with logical indeces R

Is it possible to subset a raster stack by indexing on a logical vector? r1 <- raster(nrow = 100, ncol = 100) r1[] <- round(runif(ncell(r1), 1, 4), 0) r2 <- raster(nrow = 100, ncol = 100) r2[...
1
vote
2answers
17 views

R - Create multiple linestrings from multiple coordinates

I have a dataframe with two sets of coordinates X,Y and prevXal,prevYval and I would like to make linestrings column wise, and create an sf object of the same number of linestrings as rows in the ...
3
votes
1answer
54 views

Exporting crown boundaries from tree segmentation in R?

I am using lidR package to segment my trees using lastrees directly from the points clouds. The function works fine, however I would like to export to vector file the canopy boundaries from ...
3
votes
1answer
45 views

Watershed a catalog RasterStack in place of RasterLayer in lidR?

I want to use watershed with lidR package on a catalog. I paste this command: rep <- "/home/lasfiles" new_ctg <- catalog(rep) lidR:::catalog_laxindex(new_ctg) opt_output_files(new_ctg) <- ...
0
votes
0answers
31 views

Pixels, distance to line (negative left, positive right) r

I am using r to do some spatial analysis. Here is my project, I am using raster files (that contain information on land use) and a polyline (which is a border between two regions). I am analyzing ...
1
vote
1answer
16 views

Polygon to line (polyline) in R

I am looking for an easy way to convert a polygon to a polyline in r. I have tried this but dit not succeed: polygon <- readOGR("~path/", "polygon.shp") polyline <- as(polygon, "...
0
votes
1answer
24 views

R and Mapview: How can I chose different colors for different layers?

Here is an example: library(sp) library(mapview) data(meuse) d<-st_as_sf(meuse,coords = c("x","y")) d1<-d[sample(nrow(d),20),] d2<-d[sample(nrow(d),20),] mapview(list(d1,d2)) Both layers,...
3
votes
1answer
22 views

Is it possible to default an output directory for R Scripts in QGIS 3.4.4?

I am currently running R Scripts through the Processing R Provider plugin on QGIS 3.4.4. I was wondering if it is possible to to set a default file path for your vector output that is the same as ...
0
votes
0answers
23 views

Empty output rasters when running the bfmSpatial function in R

I have 131 monthly MOD11A2 (LST) images and I want to make a time series analysis using the BFAST Monitor. The images came from the average of the original 8day products. I have made them a time ...
0
votes
0answers
20 views

Is it possible to prompt messages and see progress when running R Script in QGIS 3.4.4? [closed]

I have an R Script which I am implementing in QGIS 3.4.4 with the Processing R Provider plugin. I would like to now if it is possible to view progress in the GUI whilst running this script and also ...
2
votes
1answer
33 views

Tolerance setting in watershed segmentation(EBimage/lidR) in R

Can anyone here explain to me what the "tol" parameter in the watershed algorithm implemented in the BioConductor package EBImage (and lidR) does? I find the explanation in the EBImage help difficult ...
-1
votes
0answers
16 views

Split raster into 4 equal tiles with splitRaster() function in R, error [closed]

I want to split multiple raster into 4 equal segments, I found the splitRaster() function from the SpaDES package, which seems to do exactly this. However, it results in an error while executing. ...
1
vote
0answers
17 views

How to include duplicate samples (same locations, different temporal sampling) in Geographically Weighted Logistic Regression? [closed]

I want to assess local most important predictors for a specific event within a region. The same locations (grid) were all sampled in two different time occasions. I am assuming predictors to be ...
1
vote
0answers
23 views

Warning message in raster::rotate(): “this does not look like an appropriate object for this function”

I'm attempting to rotate a stacked raster using the raster package in R. The raw stacked raster looks like this: When I attempt to rotate the raster to change the longitudinal scale from 0-360 to -...
1
vote
1answer
40 views

How to split polygons by overlapping feature?

How can I divide the multiple overlapping polygons into multiple non-overlapping polygons? Here is an example: I would like to divide the long yellow polygon in the image into 3 polygons based on ...
1
vote
2answers
50 views

How to make a raster gradient in any direction in R

How can I create a raster, where the values increase in a certain direction? I know how to do the "main" directions with full 90 degree steps, as illustrated in the image. But I would need some help ...
0
votes
0answers
18 views

Slider with tm_shape?

Is there any way to program a slider for each year of a panel data set with tm_shape? I know that this is possible with leaflet as described on a website for Geocomputation with R three quarters down ...
0
votes
1answer
29 views

Why does transformation of coordinates to UTM fail with GDAL in R

I have a CSV-list of coordinates that I know are coordinates in Gauß-Krüger (Transverse Mercator) and I want to transform them to UTM in R with GDAL. I read the csv in, separated the columns, added ...
2
votes
3answers
79 views

Coordinate system for shapefile, no .prj file, using R

I am trying to use the shapefiles found on this page for oil & gas data from the Netherlands: https://www.nlog.nl/en/files-interactive-map from table at the bottom with "ARC_grid" and "Google ...
1
vote
0answers
31 views

Orthorectification with R

How can I orthorectify an oblique image of a flat landscape when I know the conditions of the photo (coords, height, direction, lens, etc)? I would like to perform this kind of stuff from GRASS ...
3
votes
1answer
28 views

clustered st_convex_hull

I am trying to obtain a polygon from each group of points "G" but I obtain only one single polygon for all the points. I grouped data by the G variable but it doesn't work. library(sf) library(...
2
votes
1answer
27 views

How might one optimise geospatial operations on complex polygons, especially plots in R?

Question: I'm attempting to run some simple plots on some shapefiles with a high number of complex polygons. These aren't massive files - for the example below, the shapefile is 70mb (15872 obs), but ...
1
vote
1answer
48 views

How to use st_buffer?

I would like to calculate a buffer of 5km around country polygons. However, I somehow always get a warning and an error. Here is a reproducible example code. library(sp) library(sf) library(tmap) ...
0
votes
2answers
20 views

sf polygon goes black in for loop in R

I'm making this loop, it's part of a script I'm making to illustrate a percentage in a polygon (let's say instead of a pie) but then I realized it looks good as an animation; when I start plotting, ...
2
votes
1answer
69 views

Google Earth Engine scale definition and export

I am trying to download Global Surface Water (Pekel et al 2016) data from Google Earth Engine. It has a specified maximum spatial resolution of 30 [presumably meters]. When I export the data ...
3
votes
2answers
77 views

How do I calculate the Terrain Ruggedness Index for each county in the United States in R?

I have a shapefile of US counties and high-resolution elevation data that spans the entire contiguous United States. My goal is to calculate a terrain ruggedness index for each county. The functions (...
0
votes
1answer
21 views

Setting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stack

I have MODIS NDVI product (MOD13A2) for 10 years in HDF file format. Here i have 230 of such HDFs. For a single HDF, I want to set NDVI pixel values to NA with respect to Quality values in another ...
0
votes
0answers
21 views

Project data into WGS from rotated raster (CMIP5 file ) in R

I have this raster (less than 10 mb). It is a historical simulation model (SMHI) created by CMIP5 clipped for the city of Amsterdam. dropbox <- here is the file What I want to do is to convert ...
0
votes
0answers
11 views

Missing raster data from masking with a spatial polygon layer in R

I am fairly new in R and I am trying to create a new raster by using a spatial polygon layer. I have the code written by using the mask function and the output is essentially what I want, but I'm ...
-2
votes
0answers
37 views

R : Create spatial polygons from spatial points ( Lat, Long ) with criteria

I would like to create spatial polygons with spatial points data frame based on two criteria. Here is an example of my data frame. Each row represents one spatial point. ID x y ...
2
votes
1answer
39 views

Non-constant transformation of photogrammetric point clouds in R?

I have a process which attempts to register two forested point clouds using CloudCompare's Iterative Closest Point (ICP) algorithm. Often times, warping (especially in the vertical direction) occurs ...
2
votes
0answers
46 views

Extract features in .gdb file based on their attributes

I have a .gdb file with >17,000 features. Simplified example of attributes table: ID NAME DATE ETC 0001 london 2012 12 0002 london 2012 23 0003 thame 2012 45 0004 ...
1
vote
0answers
30 views

Geofencing radius distribution/ratio across multiple geofences

I understand that this problem might be simple geometry, but Im using specific shapefiles for a geographical area and looking for a specific gis solution (hopefully code). Essentially Id like to find ...
1
vote
1answer
12 views

Web API cannot derive coordinates from non-numeric matrix

I am creating an API in R with Plumber which takes in typed coordinates, then using the function below to converts the coordinates to a spatial point for use in the API def_coord <- function(x, y){...
1
vote
0answers
37 views

Radiometrically correct one UAV image

Does anyone out there know how to perform radiometric corrections on a single image taken with a multispectral sensor? I know there is proprietary software (such as PiX4D) that can do this; however, ...
0
votes
2answers
43 views

Reclassify a raster in R based on two rasters with the output containing over 1000 bands

I am trying to convert the outputs of a model into a raster based on both a temperature raster and a seasonality raster. I have over 2100 bands so ifelse statements aren't going to cut it. An example ...
0
votes
0answers
42 views

How to create a single multi-option Leaflet filter from multiple columns of R data frame in Shiny?

I am creating a Shiny Leaflet app in R where am trying to display locations (markers) that correspond to a multiple dropdown filter. The data I have has many columns, but basically looks something ...
3
votes
1answer
63 views

Filtering (lasfilter on) huge LiDAR dataset

My dataset is about 8.3 GB after loaded into R environment by using lidR package. Some points which have return number greater than number of returns need to be removed. With a small dataset, I ...
3
votes
1answer
120 views

Visualizing vertical profiles from LiDAR point clouds in R?

I would like to visualize the vertical profiles of different LiDAR point clouds in different forest types. I have extracted the z-values from the LiDAR files with lidR and put them in a dataframe with ...
0
votes
0answers
19 views

Handling of NA (pixels without values) in raster::resample in R?

How does raster::resample handle NA values with the method ngb (or mean but I am most interested in ngb)? I had thought that NA values were ignored within a larger resolution cell-grid and the values ...