# Tagged Questions

Statistical computing language and software environment.

74 views

### Wrap a raster at the 180° meridian

I have a raster file that extends longitudinally from 0° to 360°. Using R, I'd like to wrap the raster at 180°, so that longitudes between 180° and 360° are translated to the interval [-180°, 0°]. Is ...
464 views

### how to display simple arrow on the map in R using Leaflet

I try to display an arrow on the map using R and the leaflet package, code of map see my related question: # install packages install.packages(c("rgdal", "maptools", "leaflet", "htmlwidgets"), ...
220 views

### Spatial Join in R

I'm fairly new to using R for spatial work so bear with me. I have found questions similar to this but nothing that answers this question specifically enough for me to implement it. I have point data ...
355 views

### Generate HTML file with R using Leaflet

I try to display the France map on HTML with RStudio; I followed the tutorial to the World card in Creating an interactive map with leafle; Example works. I wanted to do the same just by displaying ...
55 views

### Clip beginning and end of lines in R

I have a series of lines which I need to 'top and tail' to remove the first and last x meters as roughly illustrated below with buffers of 200 m. library(geojsonio) library(rgeos) gurl <- "https://...
63 views

### How to interpolate within defined boundaries of a deformed mesh using R?

My goal is to create an interpolation map of some output model results that are mapped on a deformed mesh (from a numerical simulation). The model results are in an x-y plane (representing coordinates)...
66 views

### Extracting multiple values from list and storing them in data frame using R?

I have a list of 3 SpatialPolygonsDataFrames. Every element has a number which is the perimeter. I want through a loop to store the numbers into one cell of a data frame like: 154,526,442. I tried to ...
207 views

### Data frame to SpatialPolygonsDataFrame with multiple polygons

I have a data frame with a bunch of polygons, several points per polygon. How can I convert it to a SpatialPolygonsDataFrame object? Here's my data frame: > buildings_df lon lat ...
390 views

### R raster predict using lm() time series

I try to make a prediction in raster using linear regression based on past rasters but I can not capture the lm() model in order to feed it to predict(). # # calculate regression in a raster stack (...
138 views

### How to add a topographic map to a shapefile?

I wonder how it's possible to add this topographic information (elevation) to the map of Santa Cruz Island and all of the Galápagos Island that I have here. library(rgdal) library(rgeos) library(...
43 views

### Two rows of data.frame for one polygon

I am new in R and I am facing a problem. I have a list with many SpatialPolygonsDataFrames. Some of them are like this example This is a SpatialPolygonsDataFrame. My "problem" is that the data....
88 views

### What is faster - a matrix, raster or a dataframe?

I have rasters over which I am performing mathematical operations. For example, where I need to calculate flow distance or distance between two grid points. What format is generally considered faster ...
46 views

### G_Malloc error for Grass module(r.stream.extract) in R

I am having a big issue of this G_malloc Error while using a module of Grass (6.4.4) (r.stream.extract) in R. Initially I thought my computers configuration was low, So I switched to 8gb Ram 64-bit ...
137 views

### Reading netcdf sub variables and convert to raster grid in r

I want the open the fs variable which in under Retrival category and covert that into raster grid. library(ncdf4) file <- "http://co2web.jpl.nasa.gov/thredds/fileServer/OCO-2/B7101Ar_r02/2014/09/...
55 views

### Calculating flow distance of pixel from outlet using R?

I have created these raster files for a river basin: DEM Flow Direction Flow Accumulation Also, I have another raster with values of rainfall. All the 4 rasters have same spatial extent, ...
16 views

### How to join CSV data (based on admin boundary names) to shapefile of aforementioned boundaries in R? [duplicate]

DATA: CSV data, Shapefile Hi all! I'm looking to perform what I've been taught is called a spatial join. After researching this further, it's looking like this operation is most often called a ...
233 views

### Object-based classification using R and Orfeo Toolbox

I am trying to run an object-based classification using R. The Landsat images were segmented using Monteverdi (Orfeo Toolbox) and training samples (segments) were selected. My problem is that the ...
16 views

### extracting large layer netcdf using r [duplicate]

i am trying to extract layers from a large netcdf file using r my nc file variable are 5 variables:" [1] " double time_bnds[bnds,time] " [1] " double plev_bnds[bnds,plev] " [1] " ...
123 views

### Extracting a large layer from NetCDF using R

i am trying to extract specific data from an .nc file my nc file has the following variables hur-relative humidity lat-latitudes lon-longitudes time-time plev-pressure levels so i ...
73 views

### PostGIS Polygons to single sp object

I would like to be able to take my SQL queries for PostGIS and make each row for the geom attribute part of an sp object so I can plot it with R's leaflet bindings. I can't really share what my ...
235 views

### Converting binary TRMM to GeoTIFF using R?

I´m trying to convert a binary image of TRMM satellite to Geotiff format using this R code: setwd("C:/Users/Hugo/Desktop") trmm.data.file<-"C:/Users/Hugo/Desktop/3B42_daily.2013.04.22.7.bin" trmm....
333 views

### Transforming coordinates from WGS84 to Gauss-Krüger 5

GPS coordinates in the format of WGS84 are quite common. I need to transform them into Gauss-Krüger coordinates but I have no idea how to do that. The only things I know are that it is not easy and I ...
92 views

### Error in converting SpatialPolygonsDataFrame to Data Frame, R Script in QGIS

I am trying to convert a SpatialPolygonsDataFrame layer to a DataFrame to create plots using ggplot2 in an R Script within QGIS. I've used spatial join to append averages of BioClim mean temperature ...
67 views

### Reading files from grass into R with loop

I have a connection between GrassGIS and R. I want to read thousands files from my mapset into R. I have lines with names "line1","line2"... I know I have to use a loop for this so I did list_lines=...
78 views

### How do I fix distortions when reprojecting cshapes world maps?

I am using the cshapes package in R as a source of historically accurate country borders. While the default WGS 84 maps plot fine, I would like to reproject the maps. This introduces some distortions ...
112 views

### Use “facet_wrap” in ggplot2 with QGIS?

I'm using QGIS 2.6.1 and R version 3.2.2. I'm struggling to get the syntax on a R Script for creating plots via QGIS processing to work. My understanding is that R syntax in QGIS Processing is ...
58 views

### Spatial clustering gridded data with missing values (over water)

I'm trying to cluster a spatial dataset, and use the cluster labels as an input to a second process. I've been using the spdep package in R. I've got gridded data at .5 degree lat/lon resolution. ...
445 views

### How to extract all the polygon coordinates from a SpatialPolygonsDataframe?

I want to do something relatively simply but it seems to be very difficult to do, though I am very new to using R for spatial data so apologies if I've missed something obvious. I have a list ...
60 views

### Clipping a SpatialPoygonsDataFrame to another SpatialPolygonsDataFrame

How do I restrict a SpatialPolygonsDataFrame so that none of the polygons lie outside of an "underlying" SpatialPolygonsDataFrame? The application I have in mind involves Voronoi Polygons a la Carson ...
111 views

### Weighted zonal statistics in Python and/or R

I have raster files with precipitation data (4x4 km), monthly, for about 100 years. I have a shapefile for a watershed (which includes several polygons as sub-basins). I need the average precipitation ...
328 views

### How to clip a shapefile to an interpolated surface (contours) in R?

R novice here, trying to work through the ever-daunting task of clipping my data. I've posted several questions regarding how to clip various types of data, so here we go with another, complete with ...
138 views

### R: problem with rasterize getCover - not working

Are there any known bugs with the getCover argument in the rasterize function? (R package 'raster'). or has anyone got a fix for the following: I have a series of landcover polygons, here is a small ...
24 views

### Monthly GIMMS composites (example code doesn't run through)

Are there anyone familiar with r package 'gimms' ? I am trying to run this code: https://github.com/environmentalinformatics-marburg/gimms but I cant produce the monthly composites. The code gets ...
757 views

### R : How to build heatmap with the leaflet package

I read a post about interactive maps with R using the leaflet package. Very interesting by the way. In this article, the author create a heatmap like this: X=cbind(lng,lat) kde2d <- bkde2D(X, ...
137 views

### GPU support for geostatistics in R

I am using R for geostatistical analysis and spatiotemporal variogram calculations on a server. Although it has very high specifications but using variogramST takes a very long time (12 hours so far ...
59 views

### Function for hyperspectral rasters with 3 variables unexpected error

I am writing a script to extract vegetation indices from hyperspectral datacubes. One of the indices is the Triangular Vegetation Index for which I wrote the following function: TVI2 <- ...
161 views

### Devide heatmap into meaningful clusters

I created a heatmap containing population density data. Now I want to figure out the hotspots of this heat map. In other words: Where are the biggest population densities in my map? My first thought: ...
96 views

### Loop NDVI calculations for hyperspectral datacubes in R

I am writing a script for the processing of different hyperspectral datacubes. The datacubes contain flight lines that I've recorded with a UAV. In total there are 10 flight lines that need to be ...
156 views

### What is Shapely library alternative in R?

I want to manipulate 2D geospatial geometries in R. I am used to using Shapely in Python but I am a newbie in R. Can you suggest Shapely alternatives for R?
65 views

### Representation of spatial lines with altitude

Is there any R data structure that supports spatial lines that include height information? I'm looking for something like SpatialLinesDataFrame with support for altitude in the lines. Associating a ...
78 views

### Coordinates transformation

I have the following data base with information about rainfall for a set of meteorological stations: year station latitude longitude depto municipio date rainfall 1990 11010010 0527 N ...
121 views

### How to Construct Spatio Temporal Clusters of Time Series Data in R

I have count data of one disease for various districts of a state of India on monthly basis. Is it possible to draw spatio temporal clusters in R? I have checked some R- packages for example ...
25 views

### Spatial join between polygons and polygons using R [duplicate]

I'm trying to make a spatial join in R between two SpatialPolygonsDataFrame's. In more detail, I have zip code and electoral precinct shapefiles, and would like to know how they overlap, i.e., for ...
210 views

### R - Programmatically convert raster stack in data frame based on polygon extraction

Sorry for cross-posting. I also posted this question at the R-SIG-GEO discussion list, but since I wanted to get as much feedback as possible I decided to post it here too. I am trying to extract ...
109 views

### Divide polyline shapefile using R

I am very new to GIS in R. I have a question that may seem simple but so far I have had no luck. I am trying to split every line in a polyline shapefile into segments of three. My original file has ...
27 views

### Raster of masked area to polygon shapefile in R

I have masked() two rasters (Landsat scenes), so that I have a new raster that covers the overlapping area of both. Now, I would like to transform the overlapping area into a polygon shapefile. Do ...
88 views

### Where are the “band names” of an ENVI file once it is imported in R?

I have a .dat file (ENVI format) with specific band names, as you can see in the snapshot. I've imported this file in R, but I cannot find the band names in the R object. The command names(...
837 views

### Create interactive maps in R

I am a R user and quite new in GIS. From Adding Attribute data to shapefile? I know how to add/edit attribute data (say population) to shapefile using R. Now, I have some shapefiles with attribute ...