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.

1
vote
0answers
19 views

Clipping polygons to existing plotting area

I have an existing plotting area onto which I want to add some polygons. In order to be sure the polygons' labels are displayed within the plotting area, I'd like to clip the polygons to this area so ...
1
vote
0answers
234 views

How to add a text on a Leaflet map

Each day I need to draw a path on a map and add a text (like 4, 5 or 8 min) indicating how long it takes by car from the starting point to the destination (see the figure below). I thought it would ...
0
votes
0answers
36 views

Creating sf multiploygon from subset of points in grouped data?

I have a reproducible dataset with relocations of two animals (data below). For each location there is a DateTime stamp and a general season IndYearCorePeriod (Winter, Summer, and None). > head(...
0
votes
1answer
89 views

Create a buffer around points

This is probably one of the simplest GIS tasks to do, but I am struggling. I have tried to adapt this answer but it appears not to work Create buffers around points and merge with ...
0
votes
1answer
33 views

manipulate ASCII grid

I have an ASCII grid (Data information in this box link https://app.box.com/s/jpdalfjnyfhqbvrghd8csu3pz5b2fl2j) with the following projection information Projection POLAR Units METERS ...
1
vote
1answer
53 views

Get R scripts from on-line scripts collection

I have QGIS 2.18 installed on Win 10, I tried to add online R scripts from processing toolbox, but i get errors. "Python error: An error has occurred while executing Python code: See message log (...
1
vote
1answer
42 views

Spatial join in R - Adding points to polygons with multiple corresponding points

I have carried out a spatial join in R in order to join a points shapefile to the corresponding polygon in a polygon shapefile using over() from the sp package and spCbind(). join <- over(polygons,...
1
vote
0answers
93 views

How to style KML through LIBKML layer creation options?

I am exporting a layer from PostgreSQL to KML using the sf package in R - though I am also capable of doing it directly with ogr2ogr. I get a workable KML that looks like this. <Placemark> ...
1
vote
0answers
26 views

Silence qgis.core error messages in reticulate

I am using the qgis.core Python module in R using reticulate. I start the QgsApplication using the following code. # Start reticulate reticulate::use_python(Sys.getenv("PYTHONHOME"), require = TRUE) ...
0
votes
2answers
65 views

Select multiple rasters from location

I have a lot of rasters (almost 4000) wich are representing individual glaciers in the Alps. I would like to select only the rasters located within the french border. As I have no information in the ...
1
vote
2answers
79 views

Excluding point from Nearest neighbor search once it's been matched using R?

I have two lists of addresses, List 1 and List 2. I want to find the nearest neighbors of the list--but without assigning more than one point to any point. So say point 1A is the nearest neighbor of ...
0
votes
0answers
75 views

Extracting WMS raster values into R

I'm trying to use R to extract values from an ImageMosaic I created in a local GeoServer instance and published as a WMS. The ImageMosaic is made from many GeoTIFF raster files initially in WGS84. ...
1
vote
0answers
45 views

Spatial pattern analysis in R

This is a post originally posted on stacksoverflow, but I was recommended to post it here also. I have a lot of position data from fishing vessels, from where I would like to detect fishing ...
1
vote
0answers
58 views

R colored raster from QGIS to ggplot or tmap

I am fairly new in doing GIS work in R, but I thought this would be a nice situation to get my feet wet. Here is the situation: I need to create multiple plots with the same background, the same ...
1
vote
0answers
27 views

Swapping raster bands on disk efficiently using R

I have two raster files, each with RGB bands and an alpha layer. I would simply like to swap one of the raster's alpha bands for another, but to do so as efficiently as possible (these are very big ...
2
votes
0answers
30 views

Points and bioclim layers plot correctly in R, but not in Maxent.jar

I am trying to use Maxent.jar. This program uses a CSV file of points and ascii bioclim layers (basically, a map of the Americas with climate data) and overlays them on top of one another. I find ...
0
votes
0answers
50 views

The R sf package in spark using sparklyr

I am trying to use the sf package in R on a Spark cluster. Apperently the sf data.frame is not compatible with the spark RDD dataframe but I do not understand why this is. Question why is the list ...
0
votes
1answer
68 views

Taking 2 overlapping spatial polygon layers and creating 1 with features from one replacing those of other layer?

I have two sf multipolygon layers - one is a 5km buffer along the Mexico-US border and the other is an administrative 2-level layer of Mexico. I am trying to figure out how to layer these on top of ...
0
votes
0answers
64 views

Image orientation/projection issues in R

I collected a series of images using an UAV. Each picture is only georefence at the true centroid, so if one tries to open that image into ArcMap (for example) the picture is not going to show up in ...
1
vote
0answers
61 views

Error in calculating covariance matrix and fitting variogram model

When constructing variogram model, usually the spatial points are given, and we build a variogram model and conduct parameter estimation. But here in my question the points are not given while ...
1
vote
0answers
69 views

r - intersection of 3D objects

How can an intersection of 3D object with 3D object be done in R, for example a 3D line with 3D polygon ? Saw that "sf" provides some possibilities but didn't get the desired result. What was ...
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 ...
1
vote
1answer
52 views

Subtracting rasters after gradient field calculation in R fails?

I am attempting to write a code in R that imports 3 rasters with the same extent/projection, calculates the horizontal and vertical gradient fields (rise over run in cells), then subtract the outputs ...
1
vote
1answer
63 views

Generating lines from coordinate file using R?

I have got an excel sheet with X and Y coordinates, actually Y is constant, since it is a straight line. I want a Shapefile with as many features as distance between points. I only get one line from ...
0
votes
1answer
102 views

Create a heatmap for VISN level data in R

I am trying to create a heatmap for Veterans Integrated Service Networks (VISN) level averages. I have found these datasets containing shapefiles. I have the averages I want to plot based on the VISN,...
2
votes
0answers
29 views

Creating networks and regions KML in R

I have >500 very large KMLs that contains only point data and a reference to a .png pop-up Each KML looks like this <kml xmlns:xsd="http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd" xmlns:xmlns="...
0
votes
1answer
40 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 ...
1
vote
1answer
59 views

calculation with raster and numeric values in Loop with R

I want to do some calculations with a list of rasters of lakes. Therefore I wrote a loop, which has so far worked fine when I only used rasters. Now I have calculations with rasters and numeric ...
1
vote
1answer
50 views

R dissagregate method in python

It seems an easy question, but I can't find the Python equivalent of R's Dissaggregate: Disaggregate a RasterLayer to create a new RasterLayer with a higher resolution (smaller cells) I expected ...
2
votes
0answers
50 views

How to create a stream graph with non-spatial data

The raw data would be like this: I want to create a streamgraph with the width of the polygon being the amount in the certain date for the certain purpose, the output should be in shapefile format : ...
1
vote
0answers
108 views

SVM classification in R

I have the following dataframe containing training data to be used in a SVM classification. The first column ID must be avoided and the column Class contains the response variable. > training_S ...
2
votes
2answers
259 views

R shapefile transform longitude latitude coordinates

I want to find out the coordinates (latitude and longitude) of Texas precincts. I download the shapefile from here. I am using R to read the file and extract the coordinates: dsn.tx <- "~/.../...
1
vote
1answer
78 views

Calculating Median/Quantile of Rasterstack and converting Results to Data Frame in R

I have a Raster Stack with 32 Raster Layers. What I want to do is to calculate the median for each Raster and also the 0.25 and 0.75 quantiles. Then I want to convert the results into a dataframe. ...
0
votes
1answer
43 views

Extract pixel values using pixel condition in R

I am preparing a dataset to run a SVM classification. So far, I have a raster stack which includes a layer ([6]) for training > S1 class : RasterStack dimensions : 3865, 6899, 26664635, 6 ...
1
vote
0answers
58 views

Building footprint polygon from LoD1 CityGML 2.0 using R and sf?

I have LoD1 building data from a federal agency in Germany in the CityGML format. I would like to import and strip the data into R to get only the footprint of the buildings and an attribut about the ...
0
votes
0answers
45 views

Convert list of raster* object into rasterBrickTS object in R

I have a list of raster bricks that have a date value in the z slot. I am trying to perform weekly averages across this list. For example, if my list had one brick for each day of a single week, I ...
0
votes
0answers
84 views

RadCor Error in .local(x, …) : invalid layer names

I'm trying to do simple atmospheric corrections on a LandSat8 brick raster using the function 'radCor'. No matter what function I try I always get the response Error in .local(x, ...) : invalid layer ...
0
votes
1answer
49 views

Write information on file using exiftool_call in R

I have a series of images (.tiff) that are only georeference at the true centroid of the picture. I have calculated the missing coordinates (top right, top left, bottom right and bottom left) in the X ...
0
votes
1answer
50 views

r - turn off automatic ordering of linestrings when applying sf::st_intersection

This question is about how while using sf::st_intersection on a LINESTRING and a set of POLYGONs to get several LINESTRINGs in the CORRECT order. sf::st_intersection automatically orders the newly ...
0
votes
1answer
47 views

gstat variogram errors

I am at a complete loss on what I am doing wrong here. I am trying to build a variogram. No matter what i do i get errors. My Data: id lon lat datetime ...
0
votes
1answer
85 views

Select % of pixel that have a specific value in R

I have a the following raster layer class : RasterLayer dimensions : 3865, 6899, 26664635 (nrow, ncol, ncell) resolution : 14.83, 14.83 (x, y) extent : 361363.5, 463675.7, 5760647, ...
0
votes
2answers
170 views

Error when using projectRaster in R

I'm having a problem with projectRaster on a raster brick in WGS84 to a projected coordinate system in R. I have obtained some oceanographic data in netCDF format from the Copernicus Marine ...
3
votes
1answer
70 views

sf appears to truncate a projection string

Curious how folks deal with this type of thing where sf appears to trim the spatial projection: library(sf) library(sp) nc <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE) ...
5
votes
1answer
100 views

Cokriging: zero distance cross-semivariance in undersampled cases [gstat error]

Trying to cokrige two variables that are not perfectly colocated (one has sparser measurements than the other), I faced an issue that I'll illustrate with the following MRE. With the meuse dataset, ...
5
votes
1answer
199 views

R spTransform polygon that crosses dateline

I have created polygons with CRS = UTM (see here), which I need to transform to latitude/longitude. Some of my polygons cross the dateline, which causes the transformation to create a polygon that ...
1
vote
2answers
63 views

Remove irregular edge in Sentinel image

I have 2 Sentinel files that I join in R: library(raster) y = raster("./L1C_T36MZE_A016248_20180802T075248.tif") z = raster("./L1C_T36MZE_A016291_20180805T080721.tif") ss = raster::merge(y,z) plot(...
2
votes
0answers
64 views

GIS Clustering with drawing predefined square area around points as cluster boundaries

I have a layer of points and I would like to create clusters where a predefined square area of 5km by 5km is the boundary for the cluster. Is there a way to iteratively draw square polygons around ...
0
votes
1answer
444 views

Import multi-band TIFF in R

I am trying to import a TIFF file that contains 2 bands. When using the following code in R, it seems only the first band is being recognised. S1<-"my/path/" S1<-list.files(S1, full.names = ...
1
vote
1answer
50 views

Selecting all polygons along northern edge of shapefile in R

I have a shapefile of Mexico composed of Admin 2 polygons. I am trying to create a buffer along the Mexico-US border, in R considering this is a shapefile of Mexico only and I want to retain the ...
2
votes
3answers
275 views

Download MODIS/MCD19A2 AOD product with R

I'm looking for a programmatic way to download MODIS/MCD19A2 AOD data in R. So far, I've found a pretty solid R package called MODISTools that works nicely with the MODIS/VIIRS RESTful API. However, ...