Stack Exchange Network

Stack Exchange network consists of 175 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.

4
votes
2answers
103 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
26 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
26 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
23 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
1answer
41 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
54 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
45 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
28 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
39 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
48 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
97 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
84 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
134 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
29 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 ...
0
votes
1answer
42 views

Legend color scale problem with tmap for island

Bornholm_data <- geo_RH %>% filter(KOMNAVN=="Bornholm") tm_shape(geo_RH) + tm_fill(col="Befolkning") + tm_borders() mainland <- tm_shape(mainland_data, projection = 0) + ...
-1
votes
1answer
43 views

Dealing with Islands with sf objects and the tmap package [closed]

I have the bounderies for the municipalities in the "capital region" of Denmark. The acctual map looks like this: The yellow island is the fourth row in my sf object. I am trying to folllow the ...
0
votes
1answer
52 views

Calculating euclidian distance in R between lines and points?

I have a large SpatialLinesDataFrame "o" (~500,000 roads) and ~3000 survey points "r", I'd like to calculate the distance to the nearest line for each survey point and extract relevant columns. My ...
0
votes
1answer
32 views

How to I limit the x and y axes with tmap in r

I have made this plot with the following code: library(tmap) tm_shape(RH2) + tm_fill(col="AREAL") + tm_borders() But there is a dot on the far right (an island) which I don't ...
1
vote
1answer
31 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 ...
1
vote
0answers
72 views

Setting up R in QGIS 3 [closed]

I am running QGIS version 3.4.4-Madeira and just installed the R plugin. in Processing->Providers->R I checked the activate box. In the processing toolbox all I see under R is 'test'. The setup ...
1
vote
0answers
26 views

Describe the texture features of the image through a single value in R

My purpose is to describe the characteristics of the texture of the image through a single value (eg, second angular momentum ASM), similar to what Haralick presents in Figure 4 of his article. The ...
0
votes
1answer
71 views

Joinn shapefile attribute ID to point in R

I have a CSV file (about 1,000,000 georeferenced points) which contains point_id/latitude/longitude. I also have a shapefile which represents a grid cell_id/xmin/xmax/ymin/ymax. I am trying to join ...
13
votes
2answers
126 views

How to create a map of Denmark with ggmap

I have installed the following two packages: library(ggmap) library(maps) I have found code online to create a world map (see below). How do I zoom the plot on a country level? For example, Denmark. ...
1
vote
1answer
42 views

How should I interpret R terrain/slope output in degrees?

I'm calculating the average land gradient (in degrees) in Brazil and I do not know how to interpret the results. As I'm calculating the slope in degrees, 0.25 is 0.25 degrees, 25 degrees or should I ...
0
votes
2answers
39 views

How Color Great Lakes Blue from GADM maps

I am using getData("GADM") to obtain map data for the US and Canada. Hudson's Bay and the Atlantic are transparent so I can add a blue background that shows through. However, all the Great Lakes have ...
0
votes
0answers
18 views

Error with over() ´sp ´ package in R

I have a df with spatial points that I've converted into a spatial object (dai18) and I want to select only the points that are inside a polygon (peri_A). I think my coordinate system is incorrect, ...
2
votes
1answer
60 views

Missing R scripts in QGIS 3 after install

After install Processing R Provider plugin (v.1.0.1) in QGIS 3.4 I only got test.rsx. I'm able to create new scritps but I can't acess scripts already installed in my OS (Linux Mint 19.1) trough R ...
0
votes
0answers
17 views

ERROR in R - it cannot support the vector

I did use the function crop and mean for 434 rasters in Rstudio. Each one is very big, it corresponds almost like 1/4 of Brazil. Now I want to calculate the standard deviation between these 434 ...
0
votes
0answers
50 views

Transforming CRS of Spatial Polygon Data Frame?

The code below shows the outline of Canada obtained from GDAM as a Spatial Polygons Dataframe with a CRS of EPSG:4326. I wish to transform this to EPSG:3857 (Mercator). Yet, I obtain the following ...
0
votes
0answers
47 views

Transforming multilinestrings to single linestring using R sf?

how to transform the following multilinestring in a linestring featuring the same aspect of the multilinestring (check against plot)? ml<-structure(list(geometry = structure(list(structure(list(...
1
vote
0answers
24 views

Plot only the borders of the states excluding the national boundary

Is there a way I can just plot the boundaries if the states excluding the national boundary of the US? I have both nation as well as state shape files from the census data. I would preferably like to ...
4
votes
1answer
280 views

Processing R Provider plugin for QGIS 3.4

I downloaded Processing R Provider plugin (v.1.0.1) which allows us to use R in QGIS 3.4. Installation and settings were really smooth. This plugin automatically recognizes R installation folder and ...
1
vote
2answers
41 views

How to automate making thousands of raster layers from a CSV file in R?

I have a csv file of discrete point locations containing lat and long for different genera, with multiple entries for most genera, and I want to create a raster stack with a raster layer for each ...
2
votes
1answer
57 views

Add Date to raster layers in raster stack in R

I have a raster stack and I want to add to it a Date field which will include the year-month-day for every rasterlayer. I have my dates in a one column data.frame. I tried to do this with addLayer ...
0
votes
0answers
24 views

Raster attribute table not showing up after exporting from R

I exported a categorical raster from R and loaded it into ArcMap to visualize it. However, the attribute table is greyed out. Code In R: I first tell R that the values are factors by ratifying it. ...
0
votes
1answer
41 views

Layer names changed after reclassification of rasterstack, R

Following one of my previous questions about looping through a rasterstack (here), I now face a different issue. My initial rasterstack had dates as names (e.g. X2000_05_08.1) and I reclassified it in ...
3
votes
1answer
87 views

Interpolating LiDAR intensity images in R?

I'd like to generate 0.5 m intensity images using lidR, but the resulting raster is full of pits. Here's a reproducible example: library(lidR) LASfile <- system.file("extdata", "MixedConifer.laz", ...
0
votes
1answer
52 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
vote
1answer
70 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
55 views

Computing number of points in a raster grid cell in R

I have a country shapefile 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
26 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
70 views

Extract values from a multi band raster in R [closed]

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
18 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
42 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
47 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
18 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
18 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
24 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 (...
2
votes
0answers
27 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
115 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 ...