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
1answer
26 views

Binding multiple polygons in R

I have a directory that contains around 700 .shp files. I want to create a map in R that displays all of them. The easiest way i could think to do this was to bind them all together and then use ...
0
votes
0answers
27 views

Parameters for BSL Package in R

I am using the landsat BSL (Bare Soil Line) package from R https://rdrr.io/cran/landsat/man/BSL.html, and I am wondering why the code sample is using llimit 0.005 and not 0.01: BSL(band3, band4, ...
1
vote
1answer
34 views

Calling `Rscript` from QGIS Python Console / QGIS Plugin not working

I want to run a RScript that plots some data which is fetched by a QGIS Plugin. However it returns a non zero-exist status and breaks (when running with subprocess.check_call) or just skips the ...
0
votes
1answer
24 views

invert Y scale in rastervis R

I want to make a hovmoller diagram; I want to change the order of Y axis (to start with 2010 - on bottom and finish 1970 - to be on top: library(zoo) library(rasterVis) library(raster) download.file(...
2
votes
0answers
36 views

Generating flow path using r.drain from rgrass

I need to generate the flow path using r.drain from the rgrass7 package in RStudio. I am new to GRASS GIS and prefer to use the R package instead. I want to generate a flow path from a grid cell. ...
0
votes
0answers
17 views

Reading multiple rasters (rows) from a single PostGIS table using the PostGIS raster driver in R

I started with: How to load postgis raster layers into R? but ran into some problems. First, my data is stored with multiple rasters (time series precipitation data) each as a row in a single table....
1
vote
1answer
44 views

Get colortable from three-band RGB raster (brick) with R

I have a three band RGB Raster Geotiff. I will provide the sample data below, but I'm guessing my problem should be solvable generically. I would like to turn this three band raster into a single band ...
0
votes
1answer
78 views

Visualize polygon above the image of EVI index in R

I have MODIS images for the EVII index, with a polygon shapefile for specific areas in my area : files MODISEVI MODISEVI all polygons polygon The images of NDVI and the polygons have the same ...
0
votes
1answer
46 views

Count number of points on a line in R

I have a SpatialLinesDataFrame and a SpatialPointsDataFrame. I want to calculate the number of points that fall on a line by a specific field in the lines data frame. Example: I have a river network ...
1
vote
1answer
30 views

Define catchment boundaries with GIS using R

Using a DEM, I want to define catchment boundaries for a given location on a river. Basically, what area drains into this point. In ArcMap, I can do that with flowacc and other tools; but I'd like to ...
1
vote
1answer
47 views

Geo-reference a raster having separate latitude and longitude files in MODIS

R generated file: Python generated file: I want to georeference using external lat lng files in a MODIS data and then project it using R to WGS 84 coordinate system like how it happens using VRT ...
0
votes
1answer
37 views

Rearrange plotorder of SpatialPolygonsDataframe

I have a SpatialPolygonDataframe (loaded with readOGR) I want to plot in either tmap or leaflet. A lot of the polygons are overlapping, and the smaller polygons are completely covered by larger ...
0
votes
0answers
18 views

Extract polygons which touch specified polygon in r

I am working with a shapefile containing polygons in r. I am looking to extract a specific polygon within the shapefile and also the surrounding polygons. i.e. the polygons that directly touch my ...
0
votes
1answer
20 views

Using `gSimplify` in Chloropleth

I am learning how to create choropleth for Canada in R. I am using hrbrmstr answer as a guide line. How do I apply gSimplify selective to specific areas. For e.g. how do I apply it to Nunavut and ...
0
votes
1answer
72 views

Conditionally adding markers to map in R leaflet and shiny

I am trying to add some markers to a leaflet map in R based on conditions that I select from an selectInput command. The selectInput command lets the user choose three different numbers (1, 2 or 4). ...
1
vote
1answer
65 views

Clustering spatially connected polygons so all clusters have approximately the same size

I want to group together polygons from a shapefile a way that all the clusters formed contained approximately the same number of polygons. The problem is that the source polygons have vastly ...
0
votes
2answers
31 views

Relative Radiometric Normalization of multisensor Landsat Level 2 images using R

For my time series analysis, i need to use images of the three Landsat sensors (TM, ETM+ and OLI). I chose the already atmospheric corrected surface reflectance/Level-2 products. Due to the ...
-1
votes
0answers
23 views

Adding in water boundaries to shapefile for adjacency matrix

I have a shapefile of all the voting districts in Michigan. However, I then am using the methods described here (https://stackoverflow.com/questions/26499010/finding-adjacent-polygons-in-r-neighbors ...
0
votes
1answer
79 views

How kriging variance is calculated in R gstat?

How does exactly the krige function (a wrapper to gstat and predict functions) from package gstat calculate kriging variance (minimized estimation variance) in Ordinary Kriging? I wanted to reproduce ...
0
votes
1answer
53 views

Extract Raster to Multiple Rasters by List of Values in R?

I'd like to use the Raster package in R to process a single DEM. I'd like to use a pre-determined list of elevation values to extract multiple raster datasets from this DEM. Not all values are of ...
0
votes
1answer
24 views

Aggregating population data (at Census tract level) to voting district level in R

Suppose I had voting data from the 2016 election at voting district level, and population data (from 2010 Census, say) at the block or tract level. I am hoping there are no blocks/tracts in two ...
0
votes
2answers
35 views

Why does the Extent of NIR Band 8 Landsat image not match other bands, even when cropping to a specified extent?

I'm trying to load and then stack four bands 2,3,4 and 8 RGB and NIR from Landsat images. I have downloaded and extracted them and they are in .tif format. # loading the bands B2 <- raster("./...
1
vote
0answers
25 views

Finding Highest Percentage Overlap between two polygons? [closed]

I'm currently working with electoral and census information. Quick summary of the two geographical units I'm working with: Voting Precinct --> These polygons provide me with electoral results from a ...
0
votes
0answers
27 views

Dealing with non-nested geographic units using the RQGIS and tigris R packages

I recently came across this tutorial suggesting that the RQGIS and tigris R packages could be used to overcome issues with non-nested geographies: https://rpubs.com/corey_sparks/256942 I'm trying to ...
1
vote
2answers
152 views

How to buffer a pair of longitude and latitude coordinates in R?

I have a pair of longitude and latitude coordinates, and I want to plot a 500 meter buffer around it using leaflet or mapview. st_buffer, however, does not correctly buffer longitude/latitude data. ...
0
votes
1answer
35 views

Simplifying a SpatialPointsDataFrame in ggplot world

I've been working on a map showing lines running across Europe. Each line is coming from a GPX file, parsed in like so: spdf <- readOGR("data/file.gpx", layer = "track_points") Now, if I plot the ...
3
votes
1answer
68 views

Error in reading point cloud data (.las) in R?

I want to generate a DEM using a point cloud (.las) for which I tried reading it in R using rlas, lidR and rLiDAR : readLAS command and none of it seems to work. The LASfile is not being read at all....
0
votes
1answer
30 views

Extract raster data with coordinates

I have downloaded the following data as a GeoTIFF and I'm interested in determining the value from this raster at specific locations. raster = readGDAL("filename.TIFF") summary(raster) Object of ...
1
vote
1answer
68 views

Calculating Bare Soil Line using R?

I am using a package in R called BSL (Bare soil line), package is at https://rdrr.io/cran/landsat/man/BSL.html. I've used it successfully to run regression line for my soil study area but it is ...
0
votes
0answers
11 views

Overlaying points sampled from polylines with original polylines, null set returned, why?

I am using R to create sample points along a SpatialLines using spsample(), then I want to know which line feature each point lies on. When I use the over() to overlay the two layers, I get a null ...
0
votes
0answers
29 views

Calculate mean value of spatial data across raster

I have a list "s" containing information on the probable locations of many animals in South America. For example, this is the type of stored information and what it looks like when plotted for the ...
1
vote
0answers
38 views

Raster centroid and relationships with geoTIFF

I have a list (s) containing information on the probable locations of many animals in South America. For example, this is the type of stored information and what it looks like when plotted for the ...
0
votes
0answers
60 views

using st_join for a spatial join

I am using the sf_package to work around spatial data in r. At this stage, I want to make a spatial join so that the tax lots of my area of study inherit the attributes of the floodplain on which they ...
0
votes
1answer
83 views

Save raster (.tif) with R writeRaster function

I'm trying to modify a raster through an R script but I find an error when I try to save in the ".tif" format, while in the ".asc" format I do not find any problem. The script I use is as follows: ...
1
vote
1answer
19 views

How to filter polygons by long/lat values using sf package in R?

Suppose t is: t <- structure(list(structure(list(structure(c(-89.990791, -89.990772, -89.990901, -89.99092, -89.990791, 30.727025, 30.727083, 30.727114, 30.727057, 30.727025), .Dim = c(5L, 2L))),...
0
votes
0answers
79 views

Estimate spatial kernel density from raster and output kernel values in a grid

I would like to use a raster map (find below) to estimate or create a kernel density distribution. The objective is to extrapolate the kernel density function and re-use it in order to distribute a ...
2
votes
2answers
73 views

Sort data in an ascending order based on the geometry of an sf object in R (Sort by Lat/Long)

I am trying to sort my data based on the latitude and longitude. I have an sf object in R, which essentially stores the latitude and longitude as a separate column called geometry. See below: > ...
0
votes
1answer
33 views

R: Annual composite based on the median: How to get the index of the original layer for each pixel?

What I want: I have a list of rasterstacks which are timeseries (300+ layers) for different bands. The timeseries are irregular, and therefore I want to create annual composites based on median ndvi. ...
1
vote
0answers
22 views

Modelling habitat heterogeneity in space: R function

I'm working on spatial landscape simulations and I would like to simulate a landscape where habitat quality varies in space. I did already some simulations assuming a landscape with higher habitat ...
0
votes
1answer
19 views

Using MODIS metadata in R

I am working with MODIS 1b Data in R, and converted the HDF files into tiffs. They load and plot correctly. I am now trying to convert the values of corrected_counts_scale and ...
0
votes
0answers
89 views

Plot raster Stack in R using the plot() command and overlay polygon shapefile

I have a raster stack with 4 raster layers which I want to plot in R using the simple plot() command (not levelplot or spplot). Also, I want to plot on top of every layer a polygon shapefile of the ...
0
votes
1answer
64 views

Legend Key for discrete values in spplot

I have a shapefile with various attributes. I want to plot the shapefile using `spplot'. I first read the shapefile A <- readOGR('myshapefile.shp') I am using the following command: p <- ...
1
vote
1answer
24 views

spplot R and order of panels for Lattice plots

I have a shapefile with various attributes. I want to plot the shapefile using `spplot'. I first read the shapefile A <- readOGR('myshapefile.shp') I am using the following command: p <- ...
1
vote
0answers
74 views

Sentinel 2 preprocessing with R

I need to transform Sentinel 2 L1C imagery to preprocessed Level 2A data. Ideally this should happen in R, as the remaining processing stack is already done in R. Are there ready preprocessing ...
1
vote
0answers
28 views

Error in Universal Kriging using gstat package in R [closed]

I am trying to perform universal kriging in R using the gstat package and running into the following error: krige(formula = CDD_LT_stC ~ Imperv1km + Elev_new, locations = sp.cal_data, newdata = sp....
0
votes
0answers
28 views

Plotting the sum of the spatial and non-spatial random effects in R

I have run a Bayesian Spatial Modeling - Conditional Autoregressive model (CAR) Poisson (BYM model, CARBayes package) in R. However, I couldn't plot the sum of the spatial and non-spatial random ...
0
votes
0answers
43 views

How Can I Evaluate Spatial Autocorrelation for Points Along a Line

The Problem I would like to determine whether points measured along a line are spatially autocorrelated. More specifically, I have data describing the slope of a river measured at evenly spaced, ...
0
votes
1answer
56 views

Defining convex-hull of (clouds of) points using R? [closed]

I have multiple (clouds of) points, and would like to take the outer envelope of these points. This will allow me to polygonize my points. Using the convex-hull would help me, but in some cases, my ...
0
votes
1answer
26 views

Resampling multiple coarser raster images based on another finer resolution raster using R?

I have 2 raster images of different spatial resolution and projection. I want to resample multiple coarser images (0.25 degrees) to finer resolution(4 km) based on one finer resolution image which ...
1
vote
0answers
39 views

Access ArcGIS Pro conda env in R

Environment: Windows 7, ESRI ArcGIS Pro 2.1, R 3.5.1 with reticulate v1.10. ArcGIS Pro comes with a pre-configured python 3 conda environment that I'm trying to access in R. Related questions here ...