Statistical computing language and software environment.
3
votes
2answers
45 views
Clipping a raster in R
I am building a map for the northeastern U.S.A. The map background needs to be either an altitude map or a mean annual temperature map. I have two rasters from Worldclim.org which give me these ...
1
vote
1answer
251 views
How do I implement 'weighted' kriging in R?
I'm trying to interpolate the values of an attribute (called "disease_rate") that i've sampled at a set of spatial points and i'd like to add 'weights' to the resulting kriging estimates.
Basically, ...
5
votes
2answers
95 views
Creating randomly shaped clumps of cells in a raster from seeds of 1 cell/pixel?
As my title says, I wish to "grow" clumps of cells from seeds within a raster. My base raster is full of 1's and 0's, 1's indicate land and 0's sea/NA areas. From the 1's I wish to select 60 random ...
1
vote
1answer
179 views
Mosaic large dataset with R
I need to merge together 20 32 bit tiff.
For that I tried ArcGis but it keeps crashing (the individual tiff are about 1GB).
I need a finale Tiff in order to run some analysis and I figured that having ...
1
vote
1answer
385 views
rpy2 installation ERROR “Tried to guess R's HOME but no R command in the PATH”?
I tried to install rpy2 (pip install rpy2). I want to use the SDAPP4 extension with QGIS (QGIS shows up the message missing rpy2...). The system tells me always the same error: Tried to guess R's HOME ...
0
votes
1answer
23 views
Extraction of raster cell values based on 'rgeos' and 'raster' buffering approaches in R
I am trying to extract cell values from a raster that lie within a certain distance from a given location (i.e. buffering). Evaluating different approaches, I found out that applying gBuffer(..., ...
2
votes
2answers
65 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 ...
4
votes
2answers
60 views
How to extract values from rasters at location of points in R?
My question is about extracting values from rasters at the location of points. With the function extract this is very easy, and the function gives me a dataframe with the values of all the variables ...
6
votes
3answers
115 views
How to efficiently read and reclassify many rasters in R
I've been tasked to create a suitability analysis of wave conditions in the Gulf of Mexico. I have 2 thousand or so raster files that are about 8 MB each (2438 columns, 1749 rows, 1km cell size). ...
1
vote
2answers
46 views
Create Raster file in R from Matrix and latlons
I could use some advice on how to create a Raster file in R with a Matrix of datapoints and the coordinates stored in a seperate file.
Both, data and coordinates come from a NetCDF file. I extracted ...
2
votes
2answers
500 views
Create a ground overlay kml from georeferenced raster
I have a world georeferenced raster (5m resolution, ~4000 x 4000 pixels) that I would like to display in google earth. I am looking for a simple and effective way to generate this kml file.
Using ...
22
votes
2answers
809 views
How can I conduct Geographically Weighted Principal Component Analysis using ArcGIS, Python and SPSS/R?
I am after a description/methodology for conducting a Geographically Weighted Principal Components Analysis (GWPCA). I am happy using Python for any portion of this and I imagine SPSS or R being used ...
5
votes
2answers
112 views
R packages for deriving spatial clusters from origin-destination matrix
I have a matrix of origin-destination flows and I am trying to figure out the best way to derive X number of functional spatial clusters from the data. I haven't done this particular type of analysis ...
10
votes
1answer
449 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 ...
11
votes
1answer
929 views
How to create an attractive choropleth map in R?
I've been experimenting with choropleth mapping techniques in R, having reaped the benefits of ggplot2 for creating beautiful graphs within a powerful data analysis package.
When it comes to mapping ...
2
votes
2answers
53 views
How to utilise single 'randomForest' model for several rasters in R?
I am using randomForest package in R to derive species distribution models. When I predict the model to the RasterStack containing the predictors in which the values were extracted to build my model, ...
1
vote
2answers
45 views
Calc vs. Overlay for speeding up band math in R 'raster' package?
Regarding yesterday's question about how to speed up band math in the R 'raster' package, would it be the same to use overlay to calculate NDVI instead of calc? If that's not the case, what's the ...
1
vote
4answers
169 views
Counting road intersections and blocks
I have a shp file that consists of the road system of Mexico City. I would like to count the number of road intersections (crossings) and blocks (which I would define as a segment starting from one ...
3
votes
1answer
58 views
How to speed up band math in R 'raster' package?
I have some GeoTiff rasters with over 100 bands in total, but they are not huge: resolution is about 1200x600 and total size is less than 7 mb. I'm trying to do a simple NDVI calculation:
raster ...
1
vote
1answer
50 views
random sampling from spatial points in R
Can anyone help me out on the best package to sample from a spatial point dataset?
My dataset consists of a list of positions inside a region, and for each point I also have the name/number of the ...
1
vote
1answer
104 views
Reverse geocoding to get city, state, country data separately?
I have longitude and latitude data. I need to reverse geocode to get city, state, country data separately.
I have checked google service.
Google provides complete address to a micro level. ...
3
votes
1answer
724 views
How to calculate polygon centroids in R (for non-contiguous shapes)
I've spent a little while figuring out the answer to this question.
It's not immediately obvious from a Google search, so thought it may useful to post the answer on here. There is also an additional ...
1
vote
2answers
103 views
Plotting large numbers of objects on a chart using R and WKT format
I am retrieving thousands of geometry lines in WKT format from a Microsoft SQL Server database. I would like to plot all of those lines in one map, but I am having some difficulty with the code. How ...
0
votes
0answers
60 views
R Raster package: write NetCDF with time dimension
I am writing a rasterbrick with multiple layers to a netcdf file using the raster package in R:
writeRaster(gridfile, "Data", "CDF", overwrite=TRUE,
...
1
vote
1answer
61 views
R: data.frame to raster object error
I have a data.frame consisting of a points with an associated continuos value and their X,Y coordinates. Altough it's not stored anywhere it's projection is a Lambert conformal conic. I think this is ...
2
votes
1answer
114 views
Reading OGC geometry data from SQL server using R
I would like to write a script in R that creates a map using OGC geometry data that is stored on a Microsoft SQL server. Is there a way to read OGC geometry data using a query passed from R?
Maybe ...
7
votes
1answer
137 views
How to efficiently read a kml file into R
Hi I'm working with huge .kml files (up to 10 Gb) and need an efficient way to read them into R. Until now I've been converting them to shapefiles via QGIS and then back into R with readShapePoly and ...
2
votes
1answer
47 views
Extract number of vertices in each polygon in R
Simple question: how best to do this?
I've found one way that works, but this is very slow (when x is a SpatialPolygonsDataFrame):
y <- fortify(x)
n.verts <- aggregate(y, by=list(y$id), ...
5
votes
1answer
97 views
Export spatial overlay from R package PBSmapping
After realising that the GEOS-library in Grass and the R package rgeos is incredibly slow, i found the packe "PBSmapping" to do the same thing, a Union of two Polygons and to cut the parts with no ...
0
votes
2answers
94 views
How can I generate a fishnet grid and a matrix of percentage of overlapping in R?
I'm trying use R for create a fishnet grid like in arcGIS with many cells of same size.
In the arcGIS 9.3 we have the option of create a polygon with many small square polygons (eg. 1 x 1 degree of ...
4
votes
1answer
50 views
Subset a SpatialPolygonsDataFrame by ID in R?
I've used the gIntersect function from the rgeos package to determine which polygons intersect in two SpatialPolygonsDataFrames (spdfs). The result is a logical matrix with rownames comprising the ...
2
votes
1answer
76 views
Image classification random forest [duplicate]
I am a newbie in R. I want to classify images using random forest in R. I am trying to learn the codes. But in the mean time, is there a push button (like a gui) in R that can be used for ...
9
votes
1answer
126 views
How to find the buildings (polygons) a user can see from a given location (point) and orientation (angle range)?
I would like to retrieve the set of buildings I can see from a given location (point -lat,lng) and orientation (interval of angles) + certainly with a given depth (e.g. 100 meters). Ideally I would ...
1
vote
2answers
166 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 adivises ...
1
vote
1answer
56 views
plot path of points
I have a sample of the address histories of households.
ID ZIP1 ZIP2 ZIP3
01 XXXXX XXXXX XXXXX
02 XXXXX XXXXX XXXXX
03 XXXXX XXXXX XXXXX
04 XXXXX XXXXX XXXXX
...
It's easy enough ...
6
votes
3answers
1k views
How to find and merge duplicate points?
I have two point shapefiles: Red and Blue. Each point shapefile has a z value which represents a radius (i.e. represented as buffers in the example). A duplicate point is defined as a point that ...
1
vote
0answers
58 views
Why Stacking rasters return all values as NAs?
I have several rasters that I want to do some calculations ,basically calculating the moving average.
dir2 <- list.files("D:\\2010+2011", "*.bin", full.names = TRUE)
...
0
votes
0answers
41 views
R-raster versus ArcMap Bioclim clipped values differ?
I have a set of lat/long ccordinates for which I wanted to pull corresponding BioClim (1-19) values. I first used ArcMap, without interpolating, and came up with a set of data. I then used R's ...
3
votes
0answers
126 views
Rgeos drops associated values when intersecting polygons
I am trying to intersect two SpatialPolygonsDataFrames and get a SpatialPolygonsDataFrame as the result. Unfortunately, using the gIntersection function from rgeos (which works impressively quickly ...
1
vote
1answer
29 views
BIOMOD Error message: argument of length 0
I’m using the package BIOMOD in R to modelling habitat in rodent species. The data formatting works but I'm getting this error message when I run Modelling:
## Conputing the models ##
...
1
vote
1answer
54 views
Determining Pixel-by-pixel Catchments in ArcHydro
I used ArcHYDRO to prepare HydroDEM (5m) without sinks, Flow direction (FDR) raster, flow accumulation raster (FAC). As I understand FAC, value of pixel shows number of pixels that contribute to this ...
2
votes
1answer
58 views
Remove intersect of one polygon from another in R
I am trying to remove the intersect from Poly2 onto Poly1. Below are the coords of the 2 polygons.
> coords1
[,1] [,2]
[1,] 992.0161 7462.531
[2,] 950.1962 7413.532
[3,] 902.3632 ...
3
votes
2answers
81 views
How to cut a SHP based on another SHP using R
I have a Shapefile of points with certain information. I have another Shapefile with polygons corresponding to the states of the country I am working with (in this case Mexico). Since I only want to ...
2
votes
1answer
117 views
R: How can I create a polygon from several polygons and a line?
I have some spatial objects that I want to combine, namely three polygons and a line. The ultimate goal is to create a polygon that I can overlay on an area of a map of administrative divisions of the ...
1
vote
1answer
84 views
Rpy2 Unable to Load in Fresh QGIS Install
after installing qgis the a message given below is shown
Unable to load the plugin: Unable to load required package rpy2.
Please ensure that both R, and the corresponding version of Rpy2 are ...
4
votes
2answers
86 views
How to do a looping to Interpolate a huge Rainfall Time-series in GRASS GIS or R
In GRASS GIS I have access to a table in PostgreSQL Database with this structure:
Table Name: rainfall_time_series
Columns: id | year | month | day | value_mm | x | y | gauge_code
Setting g.region ...
0
votes
1answer
58 views
How to replace values in rasters in directory 1 based on condition on other rasters in another directory?
Having 10 raster files in one directory and another 10 rasters in another directory and both have the same dimensions.
directory 1:
files1 <- list.files("C:\\2010", "*.envi", full.names = ...
1
vote
0answers
45 views
How to remove polygons in shapefile based on attributes in R [duplicate]
I have a shapefile where some attribute data is blank. I can delete those rows attribute table using na.omit. However, the polygons remain when I map the shapefile. I'm using R to make these changes.
...
7
votes
1answer
196 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 ...
2
votes
1answer
99 views
R - Crop a pixel image produced by spatstat with a boundary shape
i am using the very good spatial statistic package spatstat to produce probability maps of spatial point patterns.
Here is a simple working result from the examples to try out.
require(spatstat)
...


