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.

0
votes
0answers
16 views

Create Semivariogram from Satellite Image

I need to generate a semi-variogram for the entire satellite image (about 20 square km in size, about 50 megabytes) so I can determine the semivariogram's range. The satellite image contains near-...
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, ...
0
votes
1answer
16 views

How to extract raster attributes by lat/long location?

How can you extract an attribute value from a raster from a point (lat/long)? Example data: Raster with attribute table - value of interest is temperature I have a list of points with lat/long ...
-1
votes
0answers
22 views

Graphing and coloring parts of map with precipitation data and include legend?

I need to graph rain data from OpenWeatherMap. I also need to shade in a red color with an opacity of 0.3, on top of the prcipitation layer. This is the code I have, but it gives me an error, that ...
0
votes
0answers
17 views

Performing PostGIS spatial joins with remote host?

I have approximately 600,000 points that must be joined to ~12 million polygons. This process happens weekly, with the potential to happen daily. The polygon data never changes, and is stored in a ...
0
votes
0answers
9 views

How to define 3 average month values in a NDVI Modis time serie

I am working with MODIS NDVI rasters from 2016. I have 365 rasters (one per day). I need to have 3 rasters per month (total = 36). First raster = average of the first 10 days. Second raster = average ...
1
vote
1answer
503 views

How to extract values from .tiff file using R?

Maybe a rather simple question, but I could not find an answer. I am trying to extract long, lat, value from a .tiff file of a map of Africa with long/lat and soil acidity as the values. Here is some ...
2
votes
0answers
22 views

Detecting QGIS file lock

I tried using rgdal::writeOGR in R to overwrite a SHP file that was open in QGIS. Error in writeOGR(x, "C:/myFiles", "testFile", : Creation of output file failed Not only did it fail to ...
0
votes
0answers
7 views

SAGA_cmd crashes (using RSAGA)

I'm using SAGA-GIS to compute some terrain attributes with a DEM of file size 3.52 GB. I use Rsaga to operate on a 64 Bit operating system with an Intel(R) Core(TM) i5-2400 CPU @ 3.10 GHz Processor, ...
0
votes
1answer
14 views

R-Scatterplot: How to match palette() to not incrementing color-column

I want to visualize the feature space in my training areas using scatterplots. I use a nested classification schema, so my class values are not incrementing but sorted in categories like 100 (...
0
votes
1answer
37 views

Using R and SQL together in sf - what is an efficient workflow?

Do anyone have any tips/tricks/workflows for working with an SQL query within a read_sf/st_read function call in RStudio? (I am struggling to figure out how to make a postgrsql/postgis example ...
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 ...
4
votes
2answers
233 views

How to filter point cloud by flightline in R?

The lidR package in R provides a way to mark individual points in a point cloud with a flightline ID by using lasflightline(). From the documentation: Retrieve each individual flightline by ...
0
votes
0answers
20 views

How to use httr R package to query thematic polygons from api.ohsome.org?

OpenStreetMap (OSM) nodes and ways provide key value pairs, for instance: key:landuse and value:vineyard. How to query the latest polygons (ways) of Toulouse from api.ohsome.org that contain the key ...
2
votes
1answer
42 views

Calculating standard metrics in multiple LiDAR files with lidR 2.0 [on hold]

I am porting my existing code to lidR version 2.0 and would like someone to let me know if I am coding efficiently. My objective is: to process a directory of LAS files normalize las files calculate ...
0
votes
1answer
9 views

Using catalog_apply in the lidR 2.0 package, convert raster outputs to data frame format

I've moved over to version 2 of the lidR package. In previous versions, the output of producing stdmetrics using catalog_apply was a data frame. In version 2.0, the outputs are stored in raster ...
0
votes
1answer
197 views

Plotting and/or exporting VIIRS SDR DNB data as GeoTIFF in R?

I already asked this question @stackoverflow however, perhaps it fits better here, due to the spatial nature of VIIRS data and the hdf5-eos file format. Im looking into how to handle .h5 (hdf-eos) ...
0
votes
1answer
18 views

Manipulating Elevation Data from the USGS National Map

I am trying out @tylermorganwall Rayshader R library. Some instructions are given here by tylermw8 to get elevation data from the USGS National Map. I am interested in obtaining data around the ...
-1
votes
0answers
10 views

Calculating average distance between points using r [on hold]

I have a data set with headings Date, Latitude and Longitude. I would like to be able to calculate the average distance between points each month to measure spread of points over time, and was ...
0
votes
1answer
18 views

st_read option does not work if parameter is separated from equal (=) sign

This is a small pet peeve. I'm reading a latin1 encoded shapefile in R using st_read and the encoding option. I just found out that if I write encoding=latin1 everything works as expected but, if I ...
3
votes
2answers
6k views

Merging and dissolving shapefile in R?

I am migrating from ArcMap to open source GIS. I've succesfully installed R and many packages in a Ubuntu 12.04 machine. I am used to linux and programming in C, but not to R and its syntax. I am ...
2
votes
1answer
501 views

Efficiently process large rasters

I am trying to process some raster layers from Global Forest Change (https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.4.html, data produced by Hansen et al., 2013). ...
0
votes
0answers
17 views

Snap to grid with sf in R

Is there a snap to grid function available in sf for R similar to ST_SnapToGrid(geometry geomA, float size)in PostGIS? It is mentioned as a solution to non-noded intersection problem for PostGIS and ...
0
votes
1answer
25 views

R levelplot: How to shade some pixels out to show statistical significance

I am posting this also on stackoverflow because the topic is in the middle between GIS and R programming. I need to include statistical significance in a map in R using rasteVis, which is based on ...
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
51 views

Convert classified point matrix to shapefile

I've use R to generate a matrix of points tagged to separate categories. Each point has a lat, long. and category. When I plot them in QGIS (using colored points of the appropriate size) it looks like ...
1
vote
1answer
39 views

IDW/Kriging running slow in R

I have a dataset with 2157335 entries, and I am performing IDW/Kriging to interpolate. But the code is running very slow. I am not sure this is because of a large dataset or there is something wrong ...
2
votes
1answer
45 views

How to create independent/fixed inset maps with leaflet?

I am trying to create a leaflet map of the USA focusing on the contiguous 48 states and then add two inset maps of Alaska and Hawaii on the side. The problem is that addMiniMap() option creates an ...
0
votes
1answer
29 views

Measure distance for spatialLine in R returns bad value

I have this spatialLine in R: library(sp) library(maptools) library(SDraw) library(leaflet) x <- c(153.9, 152.67072,147.9879,144.25364,135.45557,116.03998,76.92708,45.10622,37.02522,36.76888,36....
0
votes
1answer
45 views

Spatial (nearest neighbour) Join Between Points (GPS coordinates) and Line in R

I want to do spatial join to an OSM line data and GPS point data both in geographic coordinate system, the result which I want is a road layer(has a unique ID) with the attributes of of road and the ...
2
votes
1answer
28 views

Calculate distance between buffer and geographic points for grouped subsets (and get tally)

The data I used can be found here. After importing my data, I select a subset of points (Nest2017 in column type) to create 30 m buffers around: library(dplyr) nests<-df %>% filter(type %...
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 ...
11
votes
1answer
1k views

R Scripts in QGIS 3.0?

It seems the Processing options in QGIS 3.0 no longer include R Scripts (they are not listed as available along with SAGA, GRASS, and GDAL). Is this a change in this version of QGIS or have I had a ...
0
votes
1answer
62 views

Plotting Points in R with Google Map context. Error in download.file(urlStr, destfile, mode = “wb”, quiet = TRUE)

I am trying to plot point data with Google Map context but i keep getting an Error. I tried the same using OSM context and it worked just fine. R Code below library(RgoogleMaps) Lat <- as.vector(...
0
votes
1answer
44 views

Mismatch in area calculation using R and ArcMap?

I am new to spatial statistics using R. In this scenario, I am trying to calculate the polygons area with in a shapefile by usingrgeos::gArea and compared with ArcMap calculate geometry value. both ...
0
votes
1answer
31 views

Alignment and distribution tools for shapefiles?

Does anyone know of a native Esri tool, Python, or R package that would allow one to emulate arcmap's graphic element toolbar functionality, but for shapefiles rather than graphic elements? For ...
0
votes
0answers
15 views

Zero variance-series and NaN error in CAR models - CARBayes (S.CARbym) in R

I've been trying to run a CAR model (CARBayes package - S.CARbym function in R) to predict the risk of visceral leishmaniasis diseases in Sao Paulo state, Brazil. The covariates are precipitation, ...
0
votes
0answers
21 views

Changing the spatial resolution - stacked raster in R

Want to change higher spatial resolution UAV dataset stacked in R. Used raster package to stack the individual band. Want to change the spatial resolution to 1 m. stacked_UAV <- stack(stack_list)...
1
vote
1answer
27 views

After calling projectRaster in R, missing right edge of world map when plotting with ggplot

I'm using projectRaster and rasterToPoints in R to get a dataframe with lat/lon coordinates for plotting in ggplot but I seem to be losing the right edge of the map (New Zealand). I'm not sure if this ...
-1
votes
0answers
23 views

Why does KML file imported into R result in blank 'Description' column but data is present when viewed in QGIS?

As the title states when I import a KML file into R the Description column is blank despite the data being visible when the same file is viewed in QGIS. The KML file was a KMZ file from the Avenza app....
0
votes
0answers
19 views

Function in R to get difference between two sets of polygons comparable in speed to QGIS

I have two very large polygon shapefiles for which I need to calculate the difference between the two shapefiles. One is a shapefile of forest polygons, the other is a shapefile of road polygons. I ...
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
29 views

Unscramble RGB raster - 4D interpolation/lookup

I have a 4-band raster image (RGB), downloaded from a WMS, representing clay content of topsoil ranging from brown (high clay content) to yellow (low clay content). The 4th band is alpha-band, with ...
-1
votes
0answers
18 views

Addition of rasters which has same basename in R

I have rasters with same basenames in two different folders. I want to perform addition of two rasters with same basenames and save it in an output directory with same basename. library(raster) ...
0
votes
0answers
34 views

Calculate Bare Soil Line Intercept using R

I am using an R package called BSL (Bare soil line), package is at https://rdrr.io/cran/landsat/man/BSL.html. The BSL package uses R's lmodel2 function (https://cran.r-project.org/web/packages/lmodel2/...
0
votes
0answers
35 views

Converting raster x/y to lon/lat pairs using R? [closed]

I was able to georeference a jpg of a world map using georeferencer.com and export as a geotiff, then used the raster package in R to convert to a dataframe: dilmap <- raster("dilmap.tif") df1 <...
2
votes
1answer
15 views

Expand plotting area of raster::plot

I have a raster that I'd like to plot in the Azimuthal Equidistant projection with a grid and labels. So far I've been able to do that. However, I cannot get the labels inside the plotting area. ...
2
votes
1answer
36 views

RSAGA error using rsaga.pisr2

I just downloaded SAGA and the RSAGA package for R. I would like to use the rsaga.pisr2 function to compute solar radiation for my region of interest. I am currently getting errors related to proj4 (...
1
vote
0answers
45 views

Inconsistencies in R rasterize polygons, packages raster and sf

I was trying to calculate species richness from IUCN distribution data in R, and I decided to check my results with two different methods, both of which rely on rasterize function from the raster ...
11
votes
2answers
13k views

Calculating shortest distance from point to line using QGIS?

What is the best method to calculate the distance from the nearest road for a series of address points in QGIS, having a very big dataset? (QGIS 2.0.1, Win XP) I read the answers to previous similar ...