Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
2answers
1k views

Setting “R Folder” Path in QGIS Sextante

I have installed R via the R-Project website. I have QGIS installed via OSGEO4W (currently 1.9.0 Master), and have Sextante plugin installed and working with GRASS and SAGA providers. I am now trying ...
4
votes
1answer
582 views

Zonal Statistics for Polygons with R

I'd like to do zonal statistics / terrain analysis with polygon overlays - I achieved to get min / max like so: library(raster) library(rgdal) alt <- getData('alt', country = "AT") gadm <- ...
4
votes
4answers
2k 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 ...
6
votes
4answers
596 views

animated map in R

everybody, sorry for disturb, but I am being quite new with r faced a crucial difficuty: I want to create an animated map of Russin with changes in unemployment with differnt years, like. On the image ...
1
vote
4answers
235 views

Detection of geographical trend of a variable

What is the best method to detect and graphically display the spatial trend of a variable? I'm looking for something that tells me the probability that the trend is from "north-west to south-east" or ...
2
votes
1answer
2k views

joining polygons

I am wondering how to join spatial polygons using R code ? I'm working with census data where certain areas change over time and I wish to join the polygons and the corresponding data and simply ...
7
votes
1answer
126 views

Open source implementation of “feature density” algorithm

I'm working on a dataset of house searches - 1 polygon for each area in which people want to find a house from an online search tool. This produces many overlapping polygons. It would be great to ...
1
vote
0answers
468 views

Validation of Regression Kriging

I am interested in exploring the idea of generating a predictive model for a target variable in a spatial context. I would then like to correct the residuals of this model using kriging, i.e. in a ...
8
votes
2answers
422 views

Problem with plotting map in R

While plotting the gadm map of Russia in R, I have a problem at the 180 degree meridian, where part of the Russian region is plotted separately. You can see it on the plot using the following code ...
1
vote
1answer
105 views

Use of Grass and R w.r.t. Land Use Prediction

In my data mining term project I need to conduct a work on geospatial data related to a big city to show possible urbanization fields in next years. I've used GRASS lately on other projects so I'm a ...
2
votes
1answer
273 views

Confused about reprojecting Google Maps (latlong) to Irish Grid TM65

Trying to transform points taken from Google maps (as latitude and longitude) to Irish Grid TM65 using the spTransform in R, and I'm confused on something. Everything I find on the net tells me ...
1
vote
1answer
118 views

Remove parts of line that fall within a polygon

I have a polygon and two lines. How can I remove the portion of each line that falls within the polygon? # polygon coords <- matrix(c(-1.798123, -1.793072, -1.805767, -1.804129, -1.798123, ...
3
votes
1answer
1k views

Raster spplot legend: how to add a title beside it

After studying for a while how to create a chart from a raster object, I got almost everything I needed except to add a title to spplot's legend. What I tried: to use mtext("XXX (m)", side=4), ...
4
votes
2answers
140 views

remove segments of lines in R

I have these 3 lines: line1 <- matrix(c(-1.81209, -1.80470, -1.80616, 55.68024, 55.67947, 55.67544), ncol=2) line2 <- matrix(c(-1.80468, -1.80330, -1.79690, 55.68322, ...
1
vote
0answers
101 views

kriging Error dimensions do not match: locations xxxx data yyyy in R

I've been working (for hours) on a kriging problem. When I run an ordinary kriging model: y.ok <- krige(y~x, locations=data1,newdata=data2), I keep getting the message: Error dimensions do ...
7
votes
2answers
833 views

How to speed up the plotting of polygons in R?

I want to plot the country borders of North America over a raster image depicting some variable and then overlay contours on top of the plot using R. I have been successful in doing this using base ...
4
votes
1answer
280 views

R gridding and contouring options

I want to make an interactive web mapping application, which will grid and contour user data. My plan is to implement R scripts with Shiny, but the only R package I can find to do this is gstat. And ...
8
votes
2answers
193 views

spatial and spatiotemporal analyses

I have a dataset that consists of 247 mosquito traps placed in fixed positions and sampled weekly for 23 weeks. I also have dengue disease incidence data (indexed to home address) during the same time ...
5
votes
1answer
3k views

R : convert a spatial polygon objet to spatial polygon data frame

My goal is to modify an existing shapefile by merging certain polygons. After importing the shapefile and using the UnionSpatialPolygons command, I get the polygon outline that I want. However, this ...
11
votes
2answers
3k 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 ...
0
votes
1answer
318 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(..., ...
8
votes
2answers
443 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 ...
6
votes
2answers
2k 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 ...
2
votes
2answers
817 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 ...
2
votes
2answers
206 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 data points and the coordinates stored in a separate file. Both, data and coordinates come from a NetCDF file. I extracted ...
6
votes
3answers
2k 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). ...
3
votes
2answers
429 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
297 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 ...
3
votes
1answer
281 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
932 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. ...
1
vote
1answer
216 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 ...
2
votes
2answers
681 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
2answers
526 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 ...
1
vote
1answer
265 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
144 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), ...
11
votes
2answers
3k 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
364 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 ...
5
votes
1answer
678 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 ...
0
votes
2answers
732 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 ...
5
votes
2answers
343 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 ...
2
votes
1answer
956 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
283 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
887 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 ...
5
votes
1answer
267 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 ...
1
vote
1answer
150 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 ...
2
votes
5answers
1k 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 ...
0
votes
1answer
115 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) ...
1
vote
1answer
72 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
130 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 ...
3
votes
2answers
379 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 ...