Statistical computing language and software environment.

learn more… | top users | synonyms

6
votes
1answer
573 views

Loading a png image as a map with ggplot2/ggmap

I am trying to find a workaround for ggmap's missing support of world maps (i.e. you can't create any maps that show latitudes > 80°, due to idiosyncrasies in the mapproj package). To a limited extend ...
0
votes
0answers
24 views

A vector object not being replaced in temp folder when using 'for' loop in R

I am currently running GRASS GIS through R interface and got stuck at this point; where I am using a 'for' loop in R, and the code is as follows: for(i in 1:nrow(Snapped_SSP_DSN)) { ...
4
votes
2answers
66 views

How can I calculate flow length in QGiS/GRASS?

I have these rasters: DEM Flow Direction Flow Accumulation I would like to calculate the flow distance of every pixel to the outlet of a basin. In Arc-GIS, I can use the flow length. But I don't ...
2
votes
1answer
222 views

Intersection of two Raster objects

I have two raster objects r1 (in grey and green) and r2 (in pink) that I want to intersect with R. I tried with the R function intersect from the raster package but it only intersect the extent of the ...
2
votes
2answers
233 views

gDistance to determine closest point to polygon: does changing projection change results qualitatively?

I'm using gDistance from the rgeos package for R to find the nearest point to a polygon. The projection of both points and the polygon is +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 ...
3
votes
2answers
325 views

Strange spatial interpolation results from ordinary kriging

I'm using Ordinary Kriging to interpolate a set of spatial data. I'm working on different sets which represent different days of measurement. I get good results, apart from one specific set. Will post ...
1
vote
1answer
47 views

How to find the cell location index of a raster using Lat long information?

I have a raster for which I want to find the Cell Location (Row, Col) if I have the Lat-long information. I know how to get the value of a particular cell using lat long. ...
0
votes
2answers
227 views

Really slow extraction from raster even after using crop?

I have a large raster file (245295396) cells and stacks of rasters having 4 layers each which lie in the extent of this large raster. To start with I am trying to get value from one stack (3 channels) ...
3
votes
2answers
472 views

Loading projection along with raster in R?

Why the operation myraster = raster("test.asc") does not load the associated projection file test.prj located in the same directory as test.asc? Does raster() need a specific argument? It seems ...
3
votes
1answer
49 views

R: extract values from raster stack and aggregate results

I'd like to extract values from a rasterstack, cell by cell, and create a list of the values: ext <- extent(0,100,0,100) r1 <- raster(nrows=100, ncols=100,ext) r1[] <- sample(seq(from = 1, ...
1
vote
1answer
68 views

How to read file geodatabase with Binary field in R?

Short version: how can I get into R the dataset available at this link? (you need to log in to download, but registration is free) The dataset that is downloadable at that link expands to a ...
1
vote
1answer
51 views

Clipping raster objects in PostGIS

I'm trying to cutting a raster object (from a PostGIS table) using a shapefile with reference, extracting raster data from a polygon area. My objective to work with the clipping raster into R. I'm ...
1
vote
1answer
50 views

Store into a list multiple lists

I have list of 50 lists of pairs of SpatialLinesDataFrames. That means I have something like: [[1]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 ...
4
votes
0answers
91 views

Using R to map matching GPS data?

I have a bunch of vehicles GPS data points, which consist of "timestamp, longitude, latitude, fuel consumption and distance" and the data is OSM (open street map) based. I want to match the data ...
3
votes
1answer
88 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 ...
3
votes
2answers
144 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 ...
9
votes
0answers
407 views

Multispectral image segmentation for natural-resources applications using R

R has the capacity for image segmentation, although all of the examples I have come across utilize a single band for the segmentation (example). I am interested in combining R's capacity for random ...
19
votes
3answers
5k views

How to perform Random Forest land classification?

This is a follow-up to a previous post: Machine Learning Algorithms for Land Classification. It seems that the Random Forest (RF) classification method is gaining much momentum in the remote ...
3
votes
1answer
86 views

How do I create a SpatialLinesDataFrame from a dataframe?

I have created a data.frame in R . I want to get SpatialLinesDataFrame as a result so I understand that I have to convert the data.frame into lines, the lines into SpatialLines and the SpatialLines ...
3
votes
3answers
153 views

How do I plot points as graduated/proportional circles in R?

I'm back again with more R mapping questions! This one is concerning symbolizing points by a certain attribute with graduated/proportional circles. DATA: My full code can be found here if you're ...
0
votes
0answers
11 views

How to find mean and standard deviation of MCAR model using mcmc methods

I perform analysis of spatial data with MCAR model and I use spbayes package, the problem what I find is how to find 1.mean and standard deviation of the model.and then make the histogram of mean and ...
6
votes
4answers
346 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 ...
0
votes
0answers
32 views

DEM and r2stl() distorted models?

If I import a dem file into R and then call as.matrix() on it, I can access z values. I want to create a 3D model, but I'm getting strange results. Most of my dems are spiky and if they are smooth I ...
0
votes
1answer
48 views

When aggregating points by polygons with sp::over function, how do I include attribute data from both the points and polygons? [duplicate]

Data: Zipped ea.ml1 shapefile can be found here, and the country outline can be downloaded here at the GADM site. I've been using the Ethiopia ESRI shapefile. Branch locations are here. I have a ...
12
votes
2answers
501 views

How does spatial polygon %over% polygon work to when aggregating values in r?

I'm working on an environmental epidemiology project where I have point exposures (~ 2,000 industrial hog operations - IHOs). These IHOs spray on nearby fields, but the feces water droplets and smell ...
4
votes
2answers
64 views

How to remove unwanted columns from a polygon in R AND keep the result as a spatial data frame?

To simplify my problem, I'm gonna start at the source instead of explaining my full-map problem. I have a shapefile of Ethiopia pulled from GADM (can be downloaded here). A lot of the attribute ...
0
votes
1answer
23 views

Project to NAD83 (epsg:26912) with projectRaster - gives epsg:2152

I am working with some Landsat 8 images from the U.S. Geological Survey (USGS) Earth Resources Observation and Science (EROS) Center. I am processing the images in R, and after masking the clouds, I ...
3
votes
1answer
99 views

Speeding up extraction time of proportion of land cover types in buffer from raster using R?

I would like to extract land cover data in a buffer of 10 km around objects of class SpatialLines and calculate proportion of each land cover type. So, I used the function extract (package raster). I ...
5
votes
1answer
60 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 ...
3
votes
1answer
34 views

How do I retain all attribute data when clipping two polygons in R? [duplicate]

I would first like to say that my question is very much similar to this answered one, but the proposed solutions don't seem to be working for me. I think that my question is slightly different, as I'm ...
0
votes
1answer
77 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 <- ...
1
vote
1answer
76 views

stack rasters with different extent and resolution in a loop with R package raster

I would like to stack rasters with the R package "raster". Layers are in ascii format. I want to crop them to have the same extent and project them to have the same resolution. My code gives raster ...
5
votes
0answers
48 views

rMaps choropleth with custom json

With R I want to make an animated choropleth map with the rMaps package and a custom map. I tried to follow the example of Diego Valle described here and to use the custom map info for Datamaps. ...
0
votes
0answers
42 views

Call qgis function from R?

Is there a package to call QGIS functions directly from R? Is rPython the best alternative?
3
votes
1answer
10 views

Removing frame/plot borders from plot.im output

I am plotting point density using the plot.im command in spatstat, and my output always has a frame around the plotted image that becomes thicker when I increase resolution for export. I tried ...
0
votes
0answers
40 views

R rasterEngine Parallel Processing, serialized and unserialized memory errors

I am trying to perform some raster math and wanted to try parallel processing in R using rasterEngine. I am able to run the script for a few minutes and watch my CPU usage increase substantially, ...
7
votes
2answers
2k views

How to implement bivariate Ripley's K function?

The attached image shows a forest gap with red pine represented as circles and white pine represented as crosses. I am interested in determining if there is a positive or negative association between ...
6
votes
3answers
1k views

What is the cause of 'tearing' of polygons (artifacts) using R, ggplot and geom_polygon?

Thanks to the answer given in this question I have been able to subset and draw a map of electoral divisions in part of the UK, in this case Pembrokeshire. The resulting data frame is large and ...
4
votes
2answers
133 views

Editing the DBF for a shapefile is yielding totally different results in R and QGIS, but the attribute tables are identical

I'm having kind of a peculiar issue that I'm hoping someone can shed some light on. I'm actually creating my map in R, but I'm using QGIS as a tool to check my mapping process (R newb here). So let's ...
1
vote
1answer
55 views

Finding the area of polygons within other polygons in R

Is there a function in R which will loop through a layer of zonal polygons (i.e. a polygon grid) and return the area of a second polygon layer that is contained in each grid cell? I have a layer of ...
1
vote
1answer
41 views

Converting waveform LiDAR to discrete return format, in R?

I have an LVIS waveform LiDAR file which looks like this: head(lidar) V1 V2 V3 V4 V5 V6 V7 V8 V9 [1,] 529437.4 ...
1
vote
1answer
64 views

How to use Igraph with leaflet for R?

I try to draw a graph in map with R code : df<-data.frame("from" = c("Lyon", "Toulouse", "Paris", "Marseille"), "to"= c("Paris", "Paris", "Marseille", "Toulouse")) meta <- ...
4
votes
1answer
51 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 ...
1
vote
0answers
34 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. ...
0
votes
0answers
112 views

How to download the MODIS data from R using MODISTools library

I want to download MODIS product MOD13Q1 to use the Scientific Data Sets (SDS) layers of "250m_16_days_EVI", "250m_16_days_pixel_reliability". MODISTools library in R software provides the capability ...
7
votes
2answers
302 views

How to download MOD16 (Modis Evapotranspiration) image?

I use a 'R' script for downloading MODIS imageries. However, it doesn't give MOD16 product. I could neither find the MOD16 product in earthexplorer website. Though the desired product is available at ...
0
votes
1answer
114 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 ...
3
votes
2answers
154 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"), ...
8
votes
3answers
1k views

How to stop writeOGR from abbreviating Field Names when using “ESRI Shapefile” driver

I'm currently using the following script to add some attribute data from a table to lots of individual shapefiles: library(rgdal) specieslist <- read.csv("SpeciesList1.txt", header=F) attdata ...
0
votes
3answers
7k views

Read ESRI shape file (polygon or polyline) in R Environment

How can I read ESRI polygon/polyline shapefile in R environment using rgdal or other library ? can I get a syntax for it ?