Statistical computing language and software environment.

learn more… | top users | synonyms

-3
votes
1answer
53 views

How to colour a SpatialLinesDataFrame with Rainbow

how to color a SpatialLinesDataFrame according to some given value (Rainbow) FRA=readShapePoly("FRA_adm0.shp") grid <- raster(extent(FRA)) # Choose its resolution. I will use 2 degrees of latitude ...
0
votes
1answer
35 views

R: Voronoi tesselation from long/lat data?

I want to create a SpatialPointDataFrame and Voronoi Tesselation from my .csv data downloaded from EPA, available here: http://uloz.to/xboQc7cu/no2-calif-csv I convert my data in SPDF format in 2 ...
0
votes
0answers
20 views

R: how to correctly set number n for sample grid for IDW?

I'm trying to make IDW in R. In my tutorial, I found this approach which is easily understandable, expect of one point - why they used n = 6000 ??? how did they established the value to create a grid ...
0
votes
1answer
65 views

Adding shapes and/or icons to legend using Leaflet within R?

Is it possible, using Leaflet within R, to make a legend in such way that includes a set of icons or shapes and their corresponding value?
2
votes
0answers
26 views

Filtering Small Areas of Shapefiles Using R

I'm trying to use the method proposed by the @ialm in the Question "How to speed up the plotting of polygons in R?" There, he loads the maps using getData from the raster package, I tested and it ...
0
votes
1answer
239 views

How to convert list of stack images to time series files in R

I am using bfast package for time series analysis. But it requires the files to be read as time series. How to convert list of stacked images from 2000 to 2013 into a time series and given as input ...
0
votes
0answers
13 views

Use SVM to make prediction based on two Raster input in R

Right Now I have two raster images, one is elevation another one is slope. And I already generate a SVM model in R. Right now I want to use this SVM model to make a classification prediction using the ...
1
vote
1answer
68 views

dynamic visualization of spatiotemporal data on a grid

I am handling spatiotemporal data and it is a quite new area for me. Basically I have data related to the position of cars at a given time in Montreal. I would like to dynamically visualize the ...
1
vote
0answers
24 views

Specifying the “idp” and the “nmax” in the krige.cv function

I'm performing IDW interpolation using the idw R function from the gstat package. For the purpose of determining what combination of "idp" and "nmax" produces the lowest RMSE in leave-one-out-cross ...
18
votes
6answers
7k views

Working with PostGIS data in R?

I work with R almost all the time, and now I am using it for doing spatial data mining. I have a PostGIS database with (obviously) GIS data. If I want to make statistical spatial analysis and plot ...
1
vote
1answer
29 views

How to deal with two dimensional lat and lon variables in a NetCDF file in R?

I'm trying to convert a NetCDF file to a dataframe in R using the RNetCDF package. The NetCDF file is very different from what I have experience with, in that the lat and lon values each have two ...
43
votes
9answers
18k views

Tutorials to handle spatial data in R?

Does anyone know some good tutorials to handle spatial data in R? I know that there are some packages like rgdal and maptools but I haven't actually found usefull tutorials to get in touch with the ...
3
votes
2answers
118 views

Plot tilted map in R

I would like to plot a tilted map, similar to the image below. I would prefer to do this using ggplot2 but I'm glad if there is a solution using base R. Any ideas on how to do this? Here is a dataset ...
8
votes
6answers
9k views

how to overlay a polygon over SpatialPointsDataFrame and preserving the SPDF data?

I have a SpatialPointsDataFrame with some additional data. I would like to extract those points inside a polygon and at the same time, preserve SPDF object and its corresponding data. So far I've ...
0
votes
2answers
412 views

Conducting geographically weighted regression on a raster

I have a relatively big raster file on which I want to conduct geographically weighted regression. Size of raster ~ 2 GB and number of rows is around 100,000 One way might be to convert from raster ...
0
votes
0answers
14 views

Raster Values converted to 3.4e+38 in R

I have read a .grd file into R as RasterLayer which should only contain 1, 0 and NA as cell values. Turns out all the NA cells contain 3.4e+38 as value now. How can I change that and why does this ...
0
votes
0answers
30 views

R: why are missing choro.legend() items when displayed in zoom()? RStudio

I wish to create map of Oregon, using choropleth(). Using locator() trick I've revealed coordinates for my choro.legend() position. It seems correctly placed in my plotting window, however my legend ...
1
vote
0answers
34 views

Raster package limitations

I am very new to R and to raster package and I was hoping that someone could provide some guidance. I am trying to run a function that averages a series of rasters, 300 to be exact, they are in geotif ...
0
votes
1answer
28 views

Calculating the number of days above freezing in R

Im wondering if anyone has come across any data source that can be used to calculate the number of days where temperatures are greater than 0 degrees C, 10 C and 20 C at a global scale? I have a site ...
0
votes
2answers
37 views

How to check my EPSG and units in R when it is not defined in proj4string?

After reading my .shp in R using readOGR(), I tried to figure out what is my EPSG and what are my units in my projections? when I tape my.shp = readOGR(dsn=setwd(dsn = dsn, ...
2
votes
0answers
33 views

Error mapping data frame in R: is.data.frame(map) is not TRUE [on hold]

I am trying to generate a map using the following data and code: fileURL <- c("https://drive.google.com/open?id=0B-jAX5hT2D3hNnVtLVhROENKRGs") require(data.table) require(tidyr) require(dplyr) ...
1
vote
0answers
11 views

Using 'Index-type' raster layers with negative values as independent variables in a multiple linear model in R

Using a multiple linear model I am trying to quantify the "effect" of abiotic landscape characteristics (slope, elevation, solar radiation, and a load of terrain indices) on vegetation greenness ...
1
vote
1answer
69 views

R kriging in QGIS

I'm trying to work with the R Kriging script in QGIS (processing toolbox). I have installed R before directly to C:. I also have installed the packages raster, rgdal, sp and automap. When I'm starting ...
0
votes
0answers
20 views

Extract raster values from RASTERSBRICK using XY coordinates falling within each polygon R

I have a rasterbrick s (10000 raster layers) that actually is a time series raster. Accompanying s is a SpatialPolygonsDataFrame with many sub-polygons which can be identified by names and/or IDs etc. ...
1
vote
1answer
111 views

Programs/ languages to process netcdf files “fast”

I am using R to loop through thousands of NetCDF files (downscaled climate data), and while I am able to do it using R, the code is too slow. I am looking for a way to speed it up and to maintain ...
1
vote
2answers
762 views

How to create a time series with a NetCDF raster from Ensembles E-OBS using GDAL, R, GRASS GIS or SAGA GIS

I downloaded a NetCDF file that contains daily precipitation values from 1-1-1950 to 30-6-2013. The raster has 23191 bands. http://eca.knmi.nl/download/ensembles/download.php My goal is to analyze ...
7
votes
4answers
10k views

Converting osm file to shapefile (or data frame) in R

I was looking for a road shapefile for Australia today. I ended up going to Geofabrik. Open Street Map has data in .osm format. But they do not have one in .shp for Australia. If possible, I want to ...
3
votes
1answer
32 views

Is it possible to start the GRASS GUI from R?

I am using the rgrass7 package in R in order to work with GRASS GIS. After having set the needed enviornment variables, I can now launch a GRASS session from R and and work on my GRASS data using ...
1
vote
1answer
34 views

Using 'sp' method to subset SpatialPointsDataFrame with SpatialPolygon returns error in parLapply()

I have numerous very large data sets of ship tracking data (Automated Information System; AIS). These are originally in a file geodatabase and can be downloaded here (this is a smaller file for ...
0
votes
1answer
28 views

Get feature type of a layer

I have to assign the feature type of a layer. Does anyone know an function, or way to access this information. I have noticed that the message of the function readOGR (package rgdal) contains an ...
2
votes
0answers
41 views

Is there an R package for finding the maximum-area rectangle in a non-convex polygon?

Does anyone know if there is an R package out there with an algorithm which finds the largest rectangle within non-convex polygons? I have Googled, searched the R Sig Geo archives, and looked here on ...
0
votes
1answer
23 views

histogram of raster coordinates in R

I'm trying to generate an histogram of the y coordinates where raster values are 1. Mysteriously the following, different rasters, give me the same histogram. What could I be doing wrong? here are ...
0
votes
1answer
87 views

Creating polygonal windows for spatial analysis in r

I am attempting to normalize a spatial point pattern using a population density raster in r. My problem is that the function I am trying to run is recognizing the "white space" around the raster I am ...
29
votes
4answers
37k views

How to open a Shapefile in R?

I need to open a shape file from ArcMap in R to use it for further geostatical analysis. I've converted it into ASCII text file, but in R it is recognized as data.frame. Coordinates function doesn't ...
1
vote
0answers
38 views

Clipping raster brick object in R

I have MODIS NDVI TIFF files for a year I want to first clip it with a irregular polygon (not by its extent only) of my study area and save it as a multi band raster in TIFF format The TIFF image are ...
8
votes
3answers
3k views

r - increase speed of crop, mask, & extract raster by many polygons

I'm extracting the area and percent cover of different land use types from a raster based on several thousand polygon boundaries. I've found that the extract function works much faster if I iterate ...
3
votes
3answers
117 views

Converting SpatialLinesDataFrame to SpatialPointsDataFrame in R?

In R I have a SpatialLinesDataFrame (for example from a coastline shapefile) and I want to convert it to a SpatialPointsDataFrame. I want to keep all the vertices from the line shapefile to become ...
1
vote
1answer
37 views

How do I get rid of edge effects while using focal in R to smooth a raster?

I am trying to use R with the focal function from the raster package to smooth raster images. I am working with Radar images that have already been preprocessed. As part of that, some calculations ...
8
votes
2answers
3k views

Removing rows in shapefile in R

I've imported a shapefile into R, and joined it to a table. My shapefile contains all the census ids, while my table only contains selected census ids. I'm now trying delete all the rows didn't get a ...
0
votes
0answers
21 views

Add information from a raster nc-file to a polygon shapefile

DATA Download from this website the following ZIP file: NUTS_2006_60M_SH.zip and save all the NUTS_RG_60M_2006 files. In what follows I refer to this as "NUTS3 regions". Download from this website ...
3
votes
2answers
67 views

How to generate a buffer outside polygons having a given pixel value?

For example, I would like to build a 20-m buffer (represented in yellow in the image below) outside polygons having a value of 2 (represented in green) and to assign the value of 3 to buffer cells. ...
1
vote
1answer
30 views

Deciphering coord. ref. in R – very basic question

I'm trying to make sense of the coord. ref. parameters for rasters in R. For example, for a given raster, crs() gives the following: +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 ...
0
votes
0answers
59 views

collocated cokriging with gstat in R

I am trying to perform cokriging with temperature as the target variable and elevation as a secondary variable. Elevation (the secondary variable) is collocated with temperature (the target variable) ...
0
votes
0answers
22 views

Using the extract function in raster package for R with polygons

I have a shape file that contains some polygons and an unprojected raster. I'd like to extract the cells within the polygons using R, so I use code like this: # Load my polygons MyPoly <- ...
0
votes
1answer
30 views

Tabulate intersect in R

I would like to get the areas related to the polygons resulting from the intersection between two SpatialPolygonsDataFrames: 'A' and 'B'. SpatialPolygonsDataFrame 'B' has 3 different 'classes', which ...
1
vote
1answer
78 views

Leaflet output is grey

I would like to implement leaflet in shiny with R. I try to go with the simple examples I found online: library(leaflet) library(ggmap) somePlace <- ggmap::geocode("Vienna") # Information from ...
3
votes
1answer
34 views

Problem with automated data storing during raster::crop (‘legend’ is not a slot in class “RasterStack”)

I am working with a set of raster layers containing CHIRPS monthly rainfall amounts over Africa. For purposes of reproducing the below code, I staged the decompressed tif files on Dropbox. Now, ...
0
votes
0answers
27 views

Estimating Daily average temperature from 2021-2050 in R

For my study I am dealing with daily temperature modeled data from 2021 to 2050. My data is in ncdf format. I want to calculate the average daily temperature across this period i.e the result should ...
1
vote
1answer
65 views

Find NoData values inside a polygon area from a raster

I have a raster (representing a polygon in black) which contains NA values (represented by white pixels) that are located inside the polygon and outside the polygon. How can I get the index value ...
0
votes
1answer
31 views

Converting data from data frame into raster file using R?

I have the following data frame (long, lat, value) (all coordinates are within Colombia): Spoints: x y z 1 -75.67083 7.57916667 7.328901e-19 2 -74.59583 ...