Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
1answer
28 views

Change countries boundaries color in a shapefile with R

I am working with R to create a map with a shapefile. I would like to change the color of the countries boundaries but I don't know how to do that. Is it possible to change the color? Here is my ...
1
vote
2answers
80 views
+100

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 ...
2
votes
2answers
42 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[] <- ...
3
votes
1answer
39 views

Join spatial polygons by code in R

I am in the process of creating a spatial polygon map for the Valencia region in Spain. I asked the question in StackOverflow (http://stackoverflow.com/q/19791210/709777) and could produce the map. ...
0
votes
1answer
64 views

Package getcartr Installation Problems

I want to build a cartogram by following this tutorial. The first thing I did, I spent the R-R-3.1.1 version 3.1.2 then I did the following: library(devtools); ...
3
votes
1answer
339 views

Find which grid cells contain a point

I have a dataframe with x,y coordinates. I've sampled 10 x,y coordinates from my dataframe: y <-c(24.637032,21.569813,21.687,19.677183,24.72438,21.433136,24.637032,22.21065,21.443762,25.273882) x ...
0
votes
1answer
42 views

Finding correlation between point location and raster value

I have what i thought was a very simple problem but i think i may have overthought it.... I have a population density raster and a point feature layer showing the locations of X (about 70 points). ...
2
votes
1answer
65 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 ...
3
votes
1answer
25 views

Add a point shapefile layer to a polygon shapefile window in R

I'm new to Spatstat for R and I'm trying to add a point layer to a window I've created from a polygon. I see questions like this have been asked before but I still can't get what I need from the ...
0
votes
3answers
33 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
1answer
446 views

How to perform a true GIS clip of polygons layer using a polygon layer in R?

I would like to do a true GIS Clip in R of soils polygons using a series of single boundary polygons, but I cannot find an R function to properly do it. It should work just like the CLIP function in ...
-3
votes
1answer
31 views

How to locate pixels and bands of image in R [closed]

the format is tiff I have read a tiff image and plot it how to locate pixels and bands of this image now
1
vote
1answer
24 views

Querying Postgis data in R using dplyr package

Does anyone have a workflow for querying postgis data in R using the dplyr package? R doesn't like the spatial columns in postgis data so can't read them in like a postgres table. I get the error ...
2
votes
0answers
22 views

R Spatial: Trouble with disjointed polygon that has self-intersections

I have a shapefile which represents the areas of a city which have higher risks of flooding than others. This is a spatial polygon object however the polygon is disjoint and not connected. I also have ...
0
votes
2answers
40 views

How to read and write tiff image and locate pixels and bands of images in R

I'm new in R I want to know how to read and write tiff format image in R and how to use R to locate pixels and bands of images My environment is in Windows when I try to read tiff image it shows ...
1
vote
1answer
31 views

How to build a function that extracts information from a set of polygons at multiple points in R

I am new to R, and trying to build a simple function that calculates an average (mean) of Sum_MVKT extracted from a set of predefined point locations. For this, I have two shapefiles named ...
4
votes
1answer
2k views

Joining polygons in R

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 ...
0
votes
0answers
20 views

Hausdorff distance is too big for similar polylines [closed]

I am using Hausdorff distance to compare two polylines as follows: library(rgeos) hdist <- rgeos::gDistance(mySpatialLines[1], mySpatialLines[2], byid=FALSE, hausdorff=TRUE) x11() ...
5
votes
2answers
2k 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 ...
1
vote
1answer
155 views

Convert point to grid: Numbers of cells differ

In R I am trying to aggregate points data to a grid. The data for the grid (G-Econ) comes as a csv-file. In this file each row represent a grid-cell at 1x1 degree resolution and the given ...
2
votes
0answers
22 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 ...
1
vote
2answers
25 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 ...
6
votes
3answers
136 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
52 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 ...
0
votes
2answers
29 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
29 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 ...
18
votes
4answers
16k views

How to open a Shapefile in R?

I need to open a shape file from ArcMap in R to use it for further geostatical analysis. I've converted it into ASCII text file, but in R it is recognized as data.frame. Coordinates function doesn't ...
1
vote
1answer
49 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
13 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 ...
0
votes
0answers
12 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 ...
4
votes
1answer
58 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 ...
2
votes
0answers
34 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
71 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 ...
0
votes
0answers
24 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
1answer
16 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 ...
4
votes
1answer
573 views

How to split a polygon using R

I have an irregular polygon which is a spatial object. I want to divide it into multiple polygons (say, n=25) with equal height. To show how I want to divide it, I've plotted grids on the ...
0
votes
0answers
24 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 ...
2
votes
1answer
247 views

How to work with flt & hdr files

I have been working on a vector-based spatial analysis in R using shapefiles. I wish to use some environmental data that is downloadable, however it is only available in raster format (FLT & HDR ...
0
votes
1answer
25 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 ...
1
vote
1answer
102 views

How to do supervised image classification in saga with the help of R script or Python script

I am using Ubuntu 12.04 and want to do image classification in SAGA. SAGA has numerous classification algorithms which is not present in GRASS and QGIS. I am new to SAGA, but more accustomed to work ...
0
votes
1answer
44 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 ...
0
votes
0answers
12 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
33 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) { ...
1
vote
1answer
87 views

R: distance from one point to many polygons

OK so I have a spatial polygons data frame, and I have a point of interest. I want to add a row to the SPDF that contains the distance from the centroid of each polygon to this given point. How do I ...
2
votes
2answers
44 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, ...
3
votes
0answers
21 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 ...
0
votes
1answer
117 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 ...
4
votes
0answers
153 views

Performing cluster analysis in R with Point Datasets

I am a R-Beginner, but I want to use it for some spatial statistics. I want to check the relation between the occurrence of ill persons and the existence of water in a area of interest. To give you a ...
1
vote
1answer
80 views

How to infer a relationship between two spatial points using R

I am quite new to the area of spatial statistics, but I'm very interested. For learning and demo purposes, I've created three datsets. Dataset - Persons: This describes individuals at a certain ...
1
vote
1answer
23 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", ...