Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
1answer
1k views

Why is my stacked area graph in ggplot2 returned as stacked lines? [closed]

im having a bit of a problem creating my stacked area chart in ggplot2 in R, for some reason it is returning as a stacked line; eg data: library(ggplot2) Sector <- rep(c("S01","S02","S03","S04","...
1
vote
1answer
43 views

Unexpected Isopleth Output From GME

I converted a csv file to projected SpatialPointsDataFrame in R, input it to bkde2D, converted the result to raster, saved the raster to a TIFF, and input that raster into the GME Isopleth tool. Here ...
2
votes
2answers
274 views

Selecting features within polygon from another layer using R or Python?

For Selecting features within polygon from another layer using QGIS? the solution was to: use the "Vector->Research tools->Select by Location" However, I would like to know how to do the same ...
2
votes
2answers
3k views

Built a query for polygon Shapefile in R

I use the package maptools to read in Shapefiles in R. I would like to know if there is a function that can built up a query/subset to select only some Polygons based on a specific attribute in the a....
0
votes
1answer
102 views

KDE looping in GME

I can not get this for loop to run in GME because i is being changed to 1 and , out is not recognized: wd <- "C:\Users\name\Desktop\KDE\2011\"; for (i in 1:15) { kde(in="C:\Users\name\Desktop\KDE\...
0
votes
0answers
41 views

Interpolate Points with GAM-Model

I'm trying to interpolate some point-data to a raster-map. Until now i used kriging to interpolate the point-data to the surface. now i have to use a generalized additive model for that task. my ...
3
votes
1answer
364 views

Reading and plotting shapefiles with a custom function in R?

I have this piece of code that want to turn into a function r <- readShapeSpatial("roads") b <- readShapeSpatial("buildings") lc <- readShapeSpatial("landcover.shp") here is the ...
1
vote
0answers
69 views

Creating grid from spatio temporal point data? [closed]

I have a spatio-temporal point data of species sighting with monthly observation for random locations within my study area. I wish to create a grid(fishnet) for each month for each year. Also, certain ...
1
vote
1answer
71 views

Zooming into State

I am using R LeaftLet package to create a interactive choropleth of the US Map. Now my question I want both in one map itself but make zip code visible as I zoom in a state or double click on a state....
0
votes
0answers
118 views

Adding additional data to R maps - package data

Is there a way to add data to additional_data result set obtained from below line of code from R maps package? additional_data <- map('county', 'iowa', fill = TRUE, col = palette()) Above ...
1
vote
0answers
101 views

Delineate watershed using manual points in RSAGA

I'm currently trying for an automated solution to delineate watersheds within a large basin. I have a collection of locations (X,Y coords) for various tributaries reaching a larger river, and the end-...
2
votes
0answers
77 views

How to visualise change matrices over time

i've hit a bit of a tricky visualisation issue; I am quantifying some land use and land use change (LULUC) over a number of years. Typically, for data going from year to the next, a land change ...
2
votes
1answer
302 views

Extracting polyline of border between differing polygons using R or GRASS?

I have a shapefile with polygons with an associated variable that can take different values. I would like to extract the borders between polygons of differing value (red and blue) as a polyline (dark ...
2
votes
3answers
1k views

How to export a dataset with “SpatialPolygonsDataFrame” as a shapefile

How to export spatial datasets in R, such as tornados dataset in GISTools package, as a shapefile with the exact same spatial reference and the exact values? library(GISTools) data(tornados) ...
3
votes
0answers
100 views

Interpreting Global Moran's I and should I krig?

I am trying to weigh up if kriging (or cokriging) the residual error from my model is a valid approach. My first step was to compute whether the error is spatially autocorrelated. I have done this ...
1
vote
1answer
803 views

Buffer analysis - use of surface area based on DEM

I have one problem and this is that I would like to create a buffer around point. This is simple with ArcMap using the buffer tool. But is it possible to create the buffer considering also the true ...
1
vote
3answers
1k views

R Spatial Kernel Density Estimation

I am new on spatial kernel density estimation with r and need some suggestions. Saying, I like to estimate the density for some event occurring at a location, for example, the probability of ...
0
votes
0answers
79 views

Error with gwr.mixed function in GWmodel r package

I applied the gwr.basic and gwr.mixed on the same SDF file using the codes below. I got an error message on gwr.mixed: Error in SpatialPolygonsDataFrame(Sr = polygons, data = mgwr.df) : row.names ...
15
votes
1answer
15k views

Projecting sp objects in R

I have a number of shapefiles in different CRSs (mostly WGS84 lat/lon) that I'd like to transform into a common projection (likely Albers Equal Area Conic, but I may ask for help on choosing in ...
11
votes
2answers
188 views

How to anonymise a gps file?

Imagine you have a GPS trace that you want to make anonymous, in the legal sense. How would you do this? Is snapping to the nearest x distance and stripping out the time enough? Are there ...
0
votes
0answers
42 views

reproject satellite orbit values from irregular grid to regular grid

I have a ncdf file containing measurements covering a satellite orbit. The ncdf contains the corresponding latitude / longitude fields but they ar irregularly spaced. I tried rasterizing the values ...
0
votes
2answers
439 views

projection conversion from mercator to google maps format

Is this spTransform(Finland3, CRS("+proj=longlat +ellps=WGS84 +no_defs+ellps=WGS84 +towgs84=0,0,0 ")) the right way to project a shapefile with this projection coord. ref. : +proj=merc +lon_0=0 +...
1
vote
1answer
96 views

Simple way to plot netCDF variables on Mollweide projection in R

After spending hours Googling I'm still no closer. I'm very keen to find out if there is a very simple way to plot up variables from a netCDF file that are stored in a regular lat-lon grid (-90to90˚N, ...
0
votes
0answers
76 views

How to effectively read and analyze multiple dbf tables?

I have multiple standalone dbf tables in a geodatabase (when saying standalone, I mean they don't have spatial components). I found this post Reading File Geodatabase using R indicated R is a ...
5
votes
1answer
894 views

ggmap, ggimage… - Saving and loading maps in R

In my current R project I'm using the ggmap package to download and display maps. What bothers me is that you need internet access to load maps from google etc. I'd like to load a map from the ...
2
votes
1answer
154 views

Proj4 for EPSG3857

I am using leaflet and the R library sp. The CRS from my leaflet map is EPSG3857 - WGS84 Web Mercator. I am retrieving the coordinates of my current map view with getBounds(). For further calculations ...
11
votes
2answers
444 views

Point overplotting on maps in R (e.g. with ggplot2) - how to push points to the side, mark original positions, combine close-by points …?

I've got a database containing languages, their longitudes and latitudes and a feature value (either category 1, category 2 or both - in the plot these are marked red, blue and green respectively). ...
1
vote
0answers
44 views

Viewshed with RpyGeo “rpygeo.Viewshed.sa”

This function is not working: rpygeo.Viewshed.sa(mnt, pt,out.raster="viewshed") *Error in as.character.default(<S4 object of class "RasterLayer">) : no method for coercing this S4 class to ...
1
vote
1answer
588 views

Connecting Grass with R

I need help to connect R with Grass. In RStudio when I send the line: loc <- initGRASS("C:/Program Files/R/R-3.1.0/bin/i386", home=tempdir(), override=TRUE) It says: Error in system(paste("g....
0
votes
0answers
17 views

Reclassifiy raster in R [duplicate]

I have a raster file which has been classified from 1 to 255. I have to reclassify into binary form where 1 to 11 must be classified as 1 and the rest must be 0.How would I be able to do it in R. My ...
0
votes
0answers
96 views

How to convert raster files from R to arff format (for Weka software)?

I'm trying to convert some raster file to .arff format for Weka software. I used the following code to convert my files, but I got an error. Does anyone know whats the problem?
3
votes
2answers
244 views

What percentage of polygon x is in raster pixel y, efficiently

I feel this is a competition worthy problem, due to its size. I would like to weight a set of raster pixels to the attributes of a set of polygons. To do this I need to know the proportion of each ...
1
vote
0answers
103 views

Subset moving window when using focal on raster in R

I have a classified Landsat image, and I'd like to pass a filter over it converting certain cells to 0. For some categories, I'd like to set cells to 0 unless an entire 7x7 window contains only that ...
3
votes
1answer
81 views

Variogram for data along linear routes

I have a dataset of some measurements along a bus route (image below). The purpose of my study is to be able to detect the values at any location along the route using Kriging interpolation. I have ...
1
vote
1answer
91 views

osmar returning objects with no features- mapping with R

> src <- osmsource_api() > bb <- center_bbox(51.3528, -0.4468, 7000, 7000) > wb <- get_osm(bb, source = src) > wb osmar object 0 nodes, 0 ways, 0 relations Trying to pull data ...
1
vote
1answer
204 views

Save raster to file when using stack() in R

I'm working on a function for raster package. In the end of the function I have to use stack() to create a RasterStack. When I do this the data source is in memory. I want to have the data source on ...
3
votes
2answers
459 views

Snapping raster grids in R

I am trying to align two raster grids in R. Once aligned I would like to be able to add them together. I have tried to check whether making a stack would work: grid_snap <- stack(habi_sdw, ...
1
vote
1answer
139 views

Dissolve overlapping polygons in R

Is there an analogue of ArcGIS Dissolve function in R? I need to dissolve the overlapping polygons and create a single part object. I was trying to use gUnionCascaded, but it creates a multipart ...
0
votes
0answers
27 views

R: Topology Exception Error

I'm trying to do the gDifference between two polygons, but I was getting an error: Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_not_poly, "rgeos_intersection") : TopologyException: ...
2
votes
0answers
70 views

Raster memory usage in R

I am working with raster/brick data in R and running into memory issues. I am basically trying to use raster objects to perform some simple agent-based modeling, but the objects keep increasing in ...
3
votes
2answers
2k views

Merging many rasters using Python

I have a list of many many rasters. I want to have a simple and easy to understand script that takes this and merges it into one big mosaic. I found a similar question but the accepted answer adivices ...
0
votes
1answer
194 views

Is there any packages to download landsat image by shapefile boundary in R or python? [closed]

I want to find a package which can automatically download images within a predefined administration boundary (shapefile format). Does anyone know a package can conduct or simplify the process?
1
vote
1answer
94 views

How to get geodetic area? rgeos::gArea doesn't seem to work. Or area-preserving projection

I need to get an area of different polygons at continental scale (like third of Africa etc.). Usual functions like rgeos::gArea work only in the projection units. Is there any function which works ...
0
votes
2answers
144 views

Exporting Matrix from ArcGIS (so readable in R)

I would like to eventually create a shape file in ArcGIS and then extract it as a matrix to be read by a spatial package I use in R. By matrix I actually mean a Raster file. My first step is to ...
0
votes
1answer
294 views

How to remove zonal anisotropy from directional variogram using gstat in R?

I have a dataframe named seoul315 contains the 107 data of PM10 concentration at 1 march,2012,5.00 am. please, download. I have tried to plot semi-variogram for kriging bt the following code: library(...
2
votes
2answers
222 views

Is there a way to get undistorted maps in R (when using the OpenStreetMap package)?

When I download a large map within R (using the OpenStreetMap package) and I reproject the map (ideally to +proj=longlat), the map will always turn out distorted, making country labels etc. near the ...
4
votes
1answer
224 views

Clip raster by raster with data extraction and resolution change

I need to stack multiple maps (tif) together and clip them all according to extent of one small raster map (second raster at the top of picture below). However, the size of pixels in each map is ...
2
votes
1answer
219 views

Difference between intersect {raster} and gIntersection {rgeos} in polygons - R?

I am interested in knowing the difference between tools: intersect {raster} and gIntersection {rgeos}** tools in R. I have several overlapping polygons and I am interested in their overlap, but mostly ...
1
vote
0answers
39 views

Can't properly map Lat/Long data on a googlemap

At the very beginning I should mention that I am a novice in spatial data handling. I am in it because I am recently doing a project where certain mining information needed to be embedded on a global ...
3
votes
1answer
89 views

Saving results in automap R package for time series data

I'm planning to interpolate monthly rainfall data from 1980 and 2010. I'm using following code: require(gstat) require(sp) require(automap) require(rgdal) require(raster) for(i in 1:ncol(data@data))...