Statistical computing language and software environment.

learn more… | top users | synonyms

3
votes
2answers
189 views

buffer and union in R without reducing to a multi-polygon

I would like to perform a spatial overlay to identify the polygon within which a set of points fall. However I first want to buffer and dissolve the polygons, such that points falling anywhere within ...
0
votes
3answers
136 views

Save rasters created by loop operation to different directory?

I have a set of rasters. I crop them all using FOR loop. Then, I want to save new-created rasters in new directory, not in my actual directory. For one raster it is easy: writeRaster(raster1, ...
2
votes
2answers
106 views

Remove clumps of pixels in R

I would like to remove isolated pixels (or clumps of pixels <9) from my raster image. library(raster) # create some raster data r <- raster(ncols=12, nrows=12) set.seed(0) r[] <- ...
2
votes
0answers
26 views

How to measure similarity of approximately congruent polylines

My initial question was posted here. The answer of whuber provides a nice solution for the case when polylines are congruent. However, the problem is that my polylines are approximately congruent ...
6
votes
3answers
217 views

How to measure similarity of SpatialLines objects

I created two SpatialLines objects in R: . These objects were created this way: library(sp) xy <- cbind(x,y) xy.sp = sp::SpatialPoints(xy) spl1 <- sp::SpatialLines(list(Lines(Line(xy.sp), ...
3
votes
1answer
62 views

Add a single column to multiple SHP

I was looking for a way to add a new column to several shp (simple polygons) at the same time. I don't know much about batch command. This new attribute is also a little bit tricky : I need to ...
1
vote
2answers
43 views

Getting raster values on grid nodes

I have my raster layers of Digital Elevation Model, aspect, slope and curvature for a certain region. In this region I want to apply a grid with a certain spacing in its nodes, and then get the ...
0
votes
2answers
79 views

System call gdal function in R on Mac

Hopefully someone can help me figure this issue out. I am trying to system call gdal functions inside of R using the system / system2 functions. Here is an example of the code: > system("gdalinfo ...
2
votes
1answer
73 views

How to write every raster from a list of rasters?

I have created a list of rasters - "norm" and run a several loops. Now I would like to write every created raster from "norm" (containing 1 layer) into one raster, having its specific name. # I can ...
1
vote
1answer
234 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 ...
1
vote
0answers
35 views

Using the accCost() function in R: questions regarding the transition layer

I am trying to use the accCost() function from the gdistance package in R. I load my cost raster using the raster()function from the raster package. According to the documentation, I need first to ...
4
votes
1answer
247 views

How to import multiple stacked raster images in R?

I have (I suppose) wery easy and silly question but I can´t really find my answer... I would like to import all multiple mosaic rasters (each mosaic is composed by 7 layers) from indicated folder into ...
0
votes
0answers
38 views

How to run GAM with raster package?

When I am using the raster package to predict a surface probability map of species distribution using the following functions in R, the following error occurrs: CA132122200=raster("F:/CBG ...
2
votes
1answer
97 views

Incomplete intersection area using gIntersection in R

I have two SpatialPolygonsDataFrame, one of them is the deforested area in the Amazon and the other is the city of Vila Rica, which is in the same region. I would like to calculate the total ...
2
votes
0answers
101 views

Calculate Euclidean distance to raster WITHIN multiple polygons

I am using ArcGIS 10.1 on a Windows x64 system. I am working in a study area where I have 360 000 locations of about 50 territorial animals. I have a shapefile containing 125 sometimes overlapping ...
2
votes
1answer
78 views

Whats the best way to convert this tab data to a raster?

I have some grid data that is stored in a xls file. The rows are lattitude and the columns are longitude values in decimal degrees (see image). What would be a quick and efficient way to convert ...
2
votes
1answer
26 views

Converting character attribute to numeric attribute

I am following the very simple code found in this question Converting shapefile to raster: Character attributes to create a new numeric variable based on a factor. My proble is that the new numeric ...
0
votes
0answers
61 views

gpclib package in R

I'm trying to do a locoh run on R version 3.1.2. Since the gpclib package is depreciated, I've installed and loaded rgeos (the package gpclib has been replaced with). However, the locoh run can still ...
0
votes
0answers
23 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) { ...
0
votes
1answer
54 views

GME: could not open input point data source

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) { ...
0
votes
1answer
65 views

For loops + boxplot for raster

I have several Rasterstacks (b1_mask, b2_mask,...) of several layers representing only a determined pixel-intensity range. (So point "A" in some layers is "NA" - in others a "value" of that certain ...
2
votes
2answers
58 views

Create lines from polygon borders with polygons attributes

I have a shapefile of polygons that border each other perfectly, each with a numerical attriubte. I'd to create a shapefile of lines, where every line is created from the border between two polygons, ...
0
votes
1answer
48 views

Extent from Centroids, Projection, and Resolution?

I have a file that defines a raster, although all the metadata was lost. I know the lat/long coordinates of the grid centroids, and that the grid is in a Mercator projection with a 1/12deg equatorial ...
3
votes
0answers
39 views

Subset two rasters with different extent and origin (and resolution) only where there are data in both in R

in R, I have two rasters with different extents and origins (and possibly even resolution). How to efficiently take the subset of each of them only where there are data in both of them? Here is a ...
1
vote
0answers
83 views

How to extract percentage of land cover from a raster according to multiple shapefiles?

I have a raster map that represents land cover of a region, and different shapefiles (total 120) in the same region. I want to know the percentage of every land cover for each shapefile. For example, ...
1
vote
0answers
41 views

Identify nearest neighbor in grid in R (spatial)

I would like to create a square grid and identify the grid cells that border a set of other grid cell for which a binary variable takes a 1. In the following example, I would like to generate a vector ...
0
votes
0answers
66 views

R using fortify to project shapefile on google map gives wrong results

I have a shapefile that looks like this > str(FieldsMap) Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 3 obs. of 2 variables: .. ..$ id : ...
1
vote
1answer
73 views

Export to images subsets of Spatial Points Data Frame

I have a csv file, which I converted it to Spatial Points Data Frame. And I want to split the spatial data and export each map to a jpg file. I did the following: SB <- read.csv("SB_040914.csv", ...
0
votes
3answers
469 views

Unable to run R in QGIS 2.6 - rgdal unavailable for R 3.1

I'm attempting to use R within QGIS2.6 on OSX Mavericks but cannot get R to run because rgdal is not available as binary for R3.1.2 (see QGIS log output from R execution console below). I have ...
0
votes
0answers
38 views

Spatial regression lag on dependent and independent variables in R

I have a SpatialPolygonsDataFrame with summarize data about some regions. How can I make a spatial regression with lag both in the independents and dependent variables in R, like this: Where y is ...
2
votes
2answers
176 views

In ESRI ArcGIS, is there an equivalent to the RStudio Console Windows?

UPDATED I know ESRI provides scripting capacity, via the Python window, but I've had a hard time with it. Making the jump from the Field calculator to the Python window was too much to me. Trying to ...
2
votes
2answers
85 views

Is there an R equivalent of NEAR in ESRI ArcGIS?

I have 54 points in one data set A I have 300+ data points in a dataset B. I wish to find the distance for each point in dataset-set B, to points in dataset A. Nearest Neighbor packages appear to ...
3
votes
1answer
67 views

comparing and finding inaccuracies in two raster layers

I have two raster layers with urban cells and rural cells. I used an overlay function to compare these two raster layers and see the differences. Before overlaying I gave urban cell the value 1 and ...
1
vote
2answers
73 views

projection differences in R

I am trying to reproject some climate data that I downloaded from http://gdo-dcp.ucllnl.org/downscaled_cmip_projections/dcpInterface.html#Welcomein The BCSD-CMIP5 data is found under the tab ...
1
vote
0answers
70 views

How to define the output raster resolution when rasterizing a vector?

I have a vector file which I want to rasterize and adjust its resolution to the reference map, in QGIS. I tried spatial_sync_raster function in R to set all the rasters into the same resolution as ...
1
vote
1answer
35 views

gTouches error without geometry error?

I have a map showing administrative boundaries (available here). I've loaded it into R and have attempted to run gTouches (from rgeos) to determine which areas are adjacent to which, but receive an ...
2
votes
2answers
227 views

combine rasters into single raster with multiple field values in R

I have several raster brick objects that I would like to combine into one raster with multiple field values for each cell, but I am not sure how to do this in R. For example, let's say I have two ...
7
votes
3answers
221 views

Best way to make a fake hillslope?

Anyone ever have to make a fake hill slope? or a fake digital elevation model (DEM)? What are the best methods for doing so? For more specifics, suppose I wanted to make a fake hill slope, that was ...
3
votes
0answers
70 views

kriging of compositional data (grain size)

I have posted this already in the GEONet Forum but without any suggestions, now I am hoping for some feedback here: I have a problem concerning interpolation of compositional data of grain sizes. I ...
0
votes
0answers
134 views

Creating the Regions based on spatial clusters

I need to create areas for my shapefiles for spatial analysis for each. So I have a number of stations and I created 5 clusters based on the distance. code: Al <- ...
2
votes
0answers
112 views

Raster to polygon using R [closed]

I am trying to convert a raster object to a polygon object using R but I am running into some problems using my Windows 7 machine. I originally tried to use rasterToPolygons (package: raster) but it ...
2
votes
0answers
63 views

How to split a polygon into quadrants in R/Qgis?

I am solving the same problem as How to split a polygon into quadrants?, except that I am looking for a solution in R or QGis. So I have a polygon layer shapefile, which is unfortunatelly not exactly ...
1
vote
0answers
34 views

Unexpected Moran's I value in R using a chessboard example

I'm running into unexpected values for Moran's I when using the Moran.I function in the R library "ape". My understanding is that a chessboard is an example of perfect negative spatial ...
10
votes
3answers
304 views

From polygon to continuous measure of diversity?

First of all; I have tried to find a similar question, without success. Maybe it's because I'm quite new to GIS and I don't really know what exactly I'm looking for. If someone points me to a similar ...
3
votes
1answer
226 views

Convert coordinates from readShapePoly in R to long-lat coordinates

I'm trying to find some centroids of a shapefile for Danish municipalities and afterwards find the driving time between them. I use R's readShapePoly function from maptools combined with the ...
2
votes
1answer
70 views

clustering map (North, Centre, South) in R

I am looking for a method to partition map in 3 groups (North, Centre, South) like this: how to do this in R please stations.txt Code : Al <- shapefile("DZA_adm/DZA_adm0.shp") # read in ascii ...
2
votes
0answers
93 views

How to merge an excel file with a shapefile in r

I am new to mapping in R so my question might look trivial. I want to have a density map of US for number of phone calls for different areas. Each area includes some zip codes. I only have number of ...
1
vote
1answer
196 views

Legend and coloring of markers with plotGoogleMaps in R

I have a data frame (X) that looks like this: code cluster name longt latit 101 1 A -89.6171 35.24992 105 1 B -90.0154 35.10510 106 2 C ...
1
vote
0answers
54 views

How to solve coordinate differences between packages

I have two maps generated by two different methods. The first, I used maps package and the function map() and symbols(). On the other hand, I used the ggmap package with the ggmap() and geom_point() ...
3
votes
1answer
124 views

Unsupervised classification with kmeans in R

I have a time series of satellite images (5 bands) and want to classify them by kmeans in R. My script is working fine (loop through my images, convert the images to data.frame, cluster them, and ...