Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
2answers
2k views

How to create a map with states by attribute value?

I'm using Qgis, but I am quite familiar with R and python. So I could use any of these. I want a map of mexico but want to color the stats according to a certain variable. It goes from 0 to 100. So ...
9
votes
2answers
1k 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 ...
8
votes
5answers
6k views

Calculate distance in km to nearest points (given in lat/long) using ArcGIS DEsktop and/or R?

I have two point datasets in ArcGIS, both of which are given in WGS84 lat/lon co-ordinates and the points are spread across the whole world. I would like to find the nearest point in Dataset A to each ...
7
votes
2answers
4k views

Join spatial point data to polygons in R

I am trying to perform a spatial join between point data and polygon data. I have data that indicate the spatial coordinates of an event in my csv file A and have another file, shapefile B, that ...
9
votes
3answers
5k views

Reading File Geodatabase using R?

File geodatabase (fgdb) includes numerous file geodatabase tables. As far as I know they exist as dbf files, but are within a Database.gdb. In ArcCatalog, the file pathway resembles C:\Users\...\...
8
votes
2answers
4k views

Clip Spatial object to bounding box in R

Given a Spatial object in R, how do I clip all of its elements to lie within a bounding box? There are two things I'd like to do (ideally I'd know how to do both, but either is an acceptable solution ...
8
votes
3answers
621 views

Fastest way to convert big raster to polyline using R or Python?

I have a big raster file (129600 by 64800 pixel) with global water bodies (1 bit values 0 and 1) and try to extract ocean and inland water shorelines. I've tried with ArcGIS and QGIS to convert from ...
6
votes
1answer
658 views

How to 'reverse clip' (erase) in R

A reverse clip saves only the part of your spatial object that is outside the bounds of another object, as opposed to a regular clip which saves the parts that are inside the other object. Here's how ...
4
votes
1answer
223 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
134 views

Incorporating terrain data to predict canopy cover using randomForest in R

This is a subjective question. Thank you bearing with me. I have a 5.8 m resolution satellite image (LISS IV by IRS-P6, in bands 4, 3 and 2) of a densely forested region in the Eastern Himalayas. My ...
2
votes
1answer
2k views

Counts the number of points in a polygon in R

I have two classes sharing the same CRS (Latitute and Longitude): bolognaQuartieriMap: a SpatialPolygonDataFrame containing data of a city boroughts. crashPoints: a SpatialPointsDataFrame containing ...
6
votes
2answers
7k views

How to make RASTER from irregular point data without interpolation

I was trying to make a raster image from an irregularly spaced point database. The data looks like- > head(s100_ras) x y z 1 267573.9 2633781 213.29545 2 262224.4 2633781 ...
4
votes
2answers
1k views

R function for Thiessen Polygons

For a point data set with temperature data I have, I want to create their Thiessen Polygons in R. So far, the only algorithm I have found is that of Carson Farmer (http://carsonfarmer.com/2009/09/...
3
votes
1answer
146 views

Processing large amounts of Rasters in R

I have 6500 processed and clipped rasters that indicate snow levels on a daily basis in the northern hemisphere. I need to create a raster that represents a sum of the snow for the season. The winter ...
3
votes
1answer
426 views

How to create randomly points within polygons for each row of a dataframe matching a Polygon ID with R

My question is similar to this post, but because there are no "perfect" answer and above all no reproducible example I open this question. I have a "SpatialPolygonsDataFrame" and a data frame. Both ...
3
votes
3answers
3k 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 ...
3
votes
1answer
569 views

remove land area from marine region polygons

In my pursuit to merge multiple polygons for the purpose of calculating the surface area of marine species distributions, using shapefiles from Marineregions, I am now trying to remove potential land ...
2
votes
3answers
2k views

Join CSV file to shapefile

I wanted to join a CSV file to a shapefile. When I identified a field to facilitate the join, e.g., map <- spChFIDs(map, as.character(map$ID)) it returned Error in spChFIDs(SP, x) : ...
1
vote
1answer
284 views

Using Loop for calculating NDVI

I am using MOD09Q1 now and I would like to calculating NDVI whole year data. One year, I have 46 band 1 images and 46 band 2 images. list.files I creating list of band 1 and list of band 2. ...
1
vote
1answer
228 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 ...
0
votes
3answers
744 views

Import shapefiles on my postgis table using R

Using R, I would like to import shapefiles that are in a directory on a geometric table i have on postgresql / postgis. What is the instruction that allows me to do it? EDIT: here is my code to ...
0
votes
1answer
1k views

r openproj to plot in open street map in a different projection

I am very new to geographic data, so I am sorry for the stupidity of the question. I need to plot some data that are in this projection EUREF_FIN_TM35FIN Projection: Transverse_Mercator ...
9
votes
1answer
721 views

Kriging on GRASS+R - cannot allocate vector of size 146.5 Mb

I'm trying to do a groundwater elevation map with an Ordinary Kriging on R, but always resulting on the lack of memory cannot allocate vector of size 146.5 Mb allocation (windows xp 32bit). ...
6
votes
3answers
3k views

How can I find out how to convert this point to lat lon?

I have received a shapefile with measurement points to be analyzed, but no matter how I try, I can't find how to convert to lat lon. I suppose it would be good to know the projection but when I look ...
4
votes
2answers
334 views

Alternatives of spTransform?

Let's say that we have a shapefile with a certain projection. s<-readOGR(dsn=".",layer="Spain") We also have the airports of Spain as points in another projection. a<-readOGR(dsn=".",layer="...
3
votes
2answers
465 views

Display two-dimensional color gradient for two different quantities

I have two overlapping raster layers. One contains quantity A from 0 to 100, and the other contains quantity B from 0 to 100. I'd like to create a map displaying both sets of data at once based on a ...
2
votes
1answer
4k views

Converting decimal degrees units to km in R?

I am trying to figure out how I can transform my unit of length from decimal degree to km when I import the following simple ArcGIS polygon shape. Ultimately, I would like to have this information ...
2
votes
1answer
1k views

How to reproject a raster from lat/lon to UTM in R?

i have to turn it into a UTM in order to make the buffer functional. wets<-readOGR(dsn=".",layer="shapefile") r.raster <- raster() extent(r.raster) <- extent(wets) res(r.raster) <- 100 ...
2
votes
1answer
221 views

R-bridge minimum requirement

The new R-bridge, unveiled at uc2015, has a dependency on ArcGIS 10.3.1. Has anybody tested it with older version of ArcGIS Desktop? I need to know why it depends on 10.3.1. I need to run it on 10.2....
2
votes
1answer
108 views

Error in In predict.gstat in R

I am trying to do kriging by gstat pcakge through R. Here is my Code: krg<-krige(var ~ 1,data,grid,model=vgm,nmax=30) But each time I recive this warning: 1: In predict.gstat(g, newdata = ...
1
vote
2answers
71 views

Create a raster with ranges from another raster

I have a raster that contains values ranging from 1-180. I am looking for a way to create a new raster where if the values of a cell in the original raster is between 1-10 the new raster cell gets the ...
0
votes
2answers
445 views

How can I fix a geoTiff with an incorrect CRS?

Trying to load and plot a raster (it's a DEM) in R, but having problems. Using R I read in a raster file: library(raster) dem <- raster("DEM_Victoria.tif") # >70 MB print(dem) class ...
0
votes
1answer
148 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 ...
0
votes
1answer
103 views

How to rasterize a vector dataset in R?

I would like to compare vector vs raster data. So i try to fix a problem using both ways. I made it in vector first : coastline<-readShapeSpatial("shp") wets<-readShapeSpatial("shp") wetb<-...
19
votes
6answers
8k 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 ...
24
votes
4answers
9k views

How to efficiently read a kml file into R

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 ...
18
votes
1answer
2k views

Robust alternatives to Moran's I

Moran’s I, a measure of spatial autocorrelation, is not a particularly robust statistic (it can be sensitive to skewed distributions of the spatial data attributes). What are some more robust ...
14
votes
3answers
779 views

How to determine if trees within forest gaps are clustered?

The attached dataset shows approximately 6000 saplings in approximately 50 variable sized forest gaps. I am interested in learning how these saplings are growing within their respective gaps (i.e. ...
14
votes
1answer
11k views

Raster legend in R: how to colour specific values?

I have an elevation model plotted in R r <- raster("example.dem") plot(r, col = topo.colors(20)) Some of the values are below sea level (0), and I'd like to have those display in red. How can ...
14
votes
3answers
797 views

Ecological geospatial conundrum

I am looking for a different, more elegant solution to a spatial statistics problem. Raw data consists of an x-y coordinate for each individual tree (i.e. converted to a point .shp file). Although ...
13
votes
2answers
3k 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 ...
10
votes
1answer
28k views

find the centroid of a cluster of points

While searching the web, solutions for finding centroids of polygons come up rather often. What I'm interested in is finding a centroid of a cluster of points. A weighted mean of sorts. I would ...
10
votes
4answers
2k views

Problems with NA values when reading .DEM file with R 'raster' package in Windows

I am trying to read a raster file in a .DEM format on windows using the 'raster' package in R. I get problems with NA values, when loading the data into R in Windows 7, but I do not have the problem ...
9
votes
1answer
4k views

How can I use fortify() to create a filtered R data frame from a shape file?

I am in the process of building a ggplot choropleth map of population in administrative areas in Wales. I have downloaded the Boundary-Line data from the Ordnance Survey and extracted what seems to be ...
8
votes
2answers
3k views

use proj4 to specify Robinson projection with R ggmap and ggplot2 packages?

I want to project this map in robinson projection: library(ggmap) world <- map_data("world") ggplot() + geom_path(data = world, aes(long, lat, group = group)) ...
6
votes
3answers
4k 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). ...
6
votes
1answer
10k views

Converting geographic coordinate system in R

I have points in geographic coordinate system and I wanted to convert them to swiss grid (CH1903+). Sample data: id lon lat 2 7.173500 45.86880 3 7.172540 45.86887 4 7.171636 45....
4
votes
2answers
8k views

Choosing the correct value for proj4string for shape file reading in R “MapTools”

I am having a shape file of polygons and another CSV file which contains a list of points as (Lat, Lng) pairs.. I want to check for each (lat, lng) pair from the CSV file which polygon does it fall ...
15
votes
2answers
2k views

How to generalize SpatialPolygons and conserving topology in R?

I would like to generalize a SpatialPolygonsDataFrame in R to make plotting more efficient. The polygons I have result in huge pdf plots that are slow to load and hard to integrate into a document. ...
13
votes
2answers
12k 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 ...