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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [r]

Statistical computing language and software environment.

0
votes
1answer
16 views

Looping a raster stack with a step, R

I have a large raster stack of about 500 rasterlayers. What I want to do is to extract specific layers and store them in a different strack. The layers for which I am interested in, have a step of 8 ...
-1
votes
0answers
7 views

Attaching new value to spatial points in graph in R?

I seek help from somebody who has experience with gbif species distribution data. What I want to do is to explore the relationship between distribution of A.pinus species and elevation to visualize ...
1
vote
1answer
41 views

Resampling 0.7 m LiDAR (in raster already) to 10 m DEM in R?

How do I resample the 0.7 m LiDAR to 10 m DEM in R? What are the basic rules for checking the consistency?
0
votes
1answer
17 views

Computing number of points in a raster grid cell in R

I have a country shape file and a dataframe with coordinates of bird sightings. My goal is to "rasterize" the shapefile and compute the number of points within each grid cell. Specifically, I want to ...
2
votes
1answer
20 views

Using viewport rotate in R?

I am trying to rotate a viewport object in R. However, I end up getting boundaries for the rotated object. Any idea as to how to rotate but not end up with these boxes? Below is the code. m_cont, ...
1
vote
2answers
32 views

Extract values from a multi band raster in R [on hold]

I currently have a raster with multi-bands. > EVI.all class : RasterLayer band : 1 (of 12 bands) dimensions : 771, 735, 566685 (nrow, ncol, ncell) resolution : 0.002245788, 0....
1
vote
0answers
13 views

Resolving topology errors after merging polygons

I have two SpatialPolygonDataFrames, and I have two merge them. SPDF1 contains watershed are falling within the country, SPDF2 has watershed are falling outside the country, so the both should match ...
1
vote
0answers
32 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
1answer
31 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 ...
0
votes
0answers
12 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 ...
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
17 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 (...
-1
votes
0answers
24 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 ...
2
votes
0answers
24 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 ...
3
votes
1answer
57 views

Calculating standard metrics in multiple LiDAR files with lidR 2.0

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
12 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 ...
-1
votes
0answers
11 views

Calculating average distance between points using r [closed]

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
20 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 ...
0
votes
1answer
19 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 ...
0
votes
1answer
27 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
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
0answers
53 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 ...
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
48 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 ...
0
votes
0answers
35 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)...
0
votes
0answers
20 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
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
24 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 ...
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
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) ...
-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
37 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
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 ...
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, ...
2
votes
1answer
16 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. ...
1
vote
1answer
58 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 ...
0
votes
0answers
44 views

Selecting and deselecting markers in leaflet under R shiny?

I would like to write a script that selects a marker on the map whenever I click on it and then deselect it when I click/select another marker (that is, so that no more that one marker is selected on ...
0
votes
0answers
24 views

Extract raster cell values by polygon field

I have a raster as a RasterLayer (raster) and a polygon layer (bound) with 38 individual polygons as a SpatialPolygonsDataFrame. I used the polygon to mask from a larger raster. Each polygon contains ...
1
vote
1answer
47 views

Plot trajectory in R

Does anyone knows a library/technique in R where you can plot a trajectory using multiple timesteps (points) where each point does have a lat/lon coordinate? I have this data x <- read.table("...
2
votes
2answers
37 views

Convert WKT coordinate reference system to PROJ4

I'm currently working on a better support of LAS 1.4 file format in the rlas R package. In LAS 1.4 format the CRS of the point cloud can be stored as a WKT string. For example this is what I read from ...
2
votes
0answers
17 views

Removing a 'non-gap' gap from a polygon that straddles +/- 180 longitude; looking for an R-based, code solution

I am working with a set of polygons from here: http://lme.edc.uri.edu/index.php/digital-data. In the artic, there are several polygons that straddle the +/- 180 longitude line. These are single ...
0
votes
0answers
11 views

Extract values from multiple rasters based on lookup of raster file name

I have 11 raster files (waveheightfiles), and need to extract one value from a different set of coordinates (station) for each raster. I have a list of 11 coordinates (df2) and have used part of the ...
0
votes
0answers
13 views

Limiting decimal digits in attribute table of a dbf file using writeOGR function of R?

I'm writing an ESRI shapefile using writeOGR function of R on a linux platform. Then I visualize the dbf file using dbfdump command to read the attributes but the real numbers in the attribute table ...
1
vote
0answers
20 views

Multipanel with raster (spplot) and scatter plot in R

I have one raster and one scatter plot that I want to put together in a single multipanel plot. However, the par(mfrow=c()) that usually works to put together different normal plots, it doesn't work ...
2
votes
0answers
30 views

How do I load these 11 images into a multi-band raster in R?

I have a landsat image with 11 bands. I need to run k means classification in R. But i do not need the whole of the image as my study area is much smaller. So I have created shape file of the Region ...
0
votes
0answers
43 views

spTransform error (unable to find inherited method for function spTransform)

I am trying to reproject a shapefile. For example, the land shapefile from Natural Earth. library(sf) shape <- read_sf(".../ne_10m_land.shp") shape_proj<-spTransform(shape, CRS("+proj=gnom +...
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 (...
0
votes
3answers
62 views

st_intersection failing for overlapping multipolygons in sf

I'm working with some user classification data on a citizen science platform. The way our workflow works is to take multiple user classifications of areas, overlay them on one another, and then look ...
0
votes
1answer
27 views

How to create and empty SpatialLinesDataFrame in R

I need to create and SpatialLinesDataFrame with a predefined structure (9 fields). I'm performing a function over a list of shp which I want to append to this empty spatiallinesdataframe. I already ...
2
votes
3answers
75 views

Batch rename MODIS data?

I have MOD13Q1 NDVI images. Data are named in this format: MOD13Q1.A2007049.h26v06.006.2015161224938_MODIS_Grid_16DAY_250m_500m_VI.tif (YYYYDDD) Here 2007 is a year and 049 is day in year. I ...