Statistical computing language and software environment.

learn more… | top users | synonyms

2
votes
0answers
35 views

R Efficient Way to Resample, Crop, and Mask a Raster Image

Does anyone know an efficient way to resample an image? I am currently trying to crop a large image and clip 2 regions from a shape file. From this clipped image, I would like to increase the pixel ...
2
votes
1answer
45 views

gBuffer(rGEOS) causing R to crash

I have downloaded a US federal lands data layer (fedlanp010g.shp.tar.gz) from http://nationalmap.gov/small_scale/atlasftp.html?openChapters=chpbound#chpbound In R, I am trying to create a buffer ...
1
vote
0answers
31 views

Get distances between boundaries from an SpatialPolygon and raster pixels

I am trying to calculate the distance from several pixels of a raster to a boundary of some polygons in R as it is showed in the image. I have two problems: How to correctly define a boundary from ...
1
vote
2answers
38 views

R calculate raster cell size in map units

I have a RasterLayer and would like to know the cell size. I haven't find any function in the packages :-S . Does someone have an idea ? info about the RasterLayer class : RasterLayer ...
3
votes
1answer
322 views

Generic comparison for kriging in geoR and ArcGIS

I am going to do a project based on kriging. The targeted area would be as big as United States and my grid would be 10km*10km. I am wondering the differences of efficiencies for the methods ...
0
votes
1answer
27 views

Defining the correct AEA proj4string for FEWSnet Rainfall Data (Southern Africa) in R [closed]

I have some general questions about how to go about solving this problem: I am trying to incorporate FEWSnet's monthly Rainfall Estimate data from 2014-2015 for Southern Africa into an analysis where ...
1
vote
2answers
44 views

R: aggregate raster with 'mode' function - how does it work?

I want to aggregate a very fine resolution raster at various coarser resolutions (that represents many 1000s of categorical polygons). The aggregate{raster} function is what i've traditionally used, ...
7
votes
4answers
167 views

How to compute max and min coordinates for multiple polygons?

I would like to calculate the maximum, median and minimum latidudinal coordinates for a large set of polygons, using QGIS or R. So the highest and lowest points reached by each polygon across a ...
0
votes
1answer
41 views

Map with ggplot2 and bubbles

I've tried to plot a map of magnitude earthquakes in Colombia with ggplot. After many efforts, I got it. But, I need to focus in specially area where the data of magnitudes is (4, 4.1, 4.2, 4.3, ...
1
vote
2answers
64 views

Improves performance on R working with raster files

I´m trying this code to look for NA and negative pixel values and replace it for 0. But it´s too slow. Any tip for improve the performance of it? "all.files" is a list of address of the images. "r1" ...
2
votes
0answers
26 views

Keys for merging US state/county ANSI's with GADM Unique identifiers?

I've got county-level data from USDA NASS, and I want to merge it with gridded climate data. A preliminary step is the associate the counties with the coordinates of their centroids. If I merge by ...
0
votes
1answer
24 views

Masking low quality raster with polygons in R gives weird overhang?

I am pretty new to R, and have been attempting to use the mask function on a raster image of 250mx250m resolution. My problem is that for some reason I am getting overhang, as there are pixels which ...
0
votes
1answer
186 views

How to convert list of stack images to time series files in R

I am using bfast package for time series analysis. But it requires the files to be read as time series. How to convert list of stacked images from 2000 to 2013 into a time series and given as input ...
5
votes
2answers
89 views

How to join a table to a shapefile with non-matching IDs and names (similar strings)?

I'm having an annoying problem that I'm trying to find an automated solution for. The shorthand version is that I have a shapefile and a table of created data for regions within countries. The created ...
0
votes
1answer
35 views

compare three rasters and three conditions with overlay in r

I'm trying to run an overlay function with rasters where I want to meet all of 3 different conditions at each cell and produce a single raster as output. Running ifelse with the & operator ...
5
votes
2answers
2k 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
1answer
255 views

R package spatstat: How to use point process model covariate as factor when pixel image values are numeric

I am trying to model a point process with an image covariate using the ppm() function in the spatstat package in R. I convert my raster to an im object for use with spatstat, and I run into a problem ...
2
votes
2answers
331 views

Clump and eliminate classes in a raster in ArcMap or R

after interpolation of sediment classes, I obtained a raster which looks like the image below (sample of the river). I would like to clump and eliminate areas within the raster that are below a ...
2
votes
2answers
337 views

Checking if points fall within polygon Shapefile

Zillow has a set of shapefiles for different neighborhoods of major US cities. I wanted to check if certain buildings were present in certain neighborhoods using R: library(rgeos) library(sp) ...
1
vote
1answer
41 views

How to get latitude and longitude data from the borders of a state in R

Here is my problem: I need to get longitude and latitude data from the borders of the Brazilian states. With this data I can plot a map of each Brazilian state and, of course, of the whole country. I ...
44
votes
11answers
7k views

What is the most useful spatial R trick?

R is becoming pretty strong tool for handling and analyzing spatial data. I learned some useful things through questions like these at SO and thought it might be useful to have something simmilar, but ...
1
vote
2answers
43 views

Embed a (saved) Leaflet map in an Ioslides presentation

I'm building some fairly complex maps with the leaflet package and I'd like to embed them in an rmarkdown document (specifically an ioslides_presentation .Rmd file). Right now the code for the maps ...
1
vote
1answer
32 views

Integrating ArcMap 10.1 Toolbox Model in R?

I have 30,000 raster files that needs to go through a small ArcMap 10.1 Toolbox Model I made (clip, flip, export to ASCII, etc.). I have a R script which then imports all the exported raster file and ...
4
votes
2answers
43 views

Accessing the Quality Band for MCD12Q1 with MODISTools GetBands

I am using MODISTools (https://github.com/seantuck12/MODISTools) to process MCD12Q1 data, which, according to the LP DAAC website ...
1
vote
0answers
33 views

Extracting data of two overlapping rasters

I am trying extract the data of two overlapping set of rasters (one, a stack of 35 rasters, all from the same source and the second an elevation raster) to get a data.frame of the values (mean of the ...
4
votes
1answer
105 views

strange output from RSAGA topographic wetness index

I am trying to generate a topographic wetness index raster with the RSAGA package in R. The output I am able to generate does not make sense to me, as it has a large number of NA cells and I wonder if ...
4
votes
1answer
54 views

Remove sliver gaps between polygons with R

Is there a way to eliminate the small "slivers" between polygons using R? The desired solution would create a new SpatialPolygonsDataFrame where the shared boundaries between polygons are coincident. ...
2
votes
0answers
43 views

How to pull a shapefile into R from PostGIS database (in Windows)?

I'm currently working on pulling data from a PostGIS database for the first time to map in R and need some help. The database contains a shapefile of countries/regions of the world. I am able to pull ...
2
votes
1answer
24 views

Error when trying to subset a vector to a dataframe

I'm not sure if I've used the correct terminology in my title, so please forgive me if that doesn't entirely make sense. For the sake of reproducing my example, I've created a dummy example. As ...
2
votes
1answer
52 views

Plot attribute of shapefile with R

Does anybody know how to plot any attribute of a shapefile with R? For example, like this.
2
votes
1answer
52 views

How to rasterize an object of class SpatialPolygonsDataframe in R

When I read a polygon shapefile into R using rgdal, it was imported as an object of class SpatialPolygonsDataframe. I need to rasterize the polygon, but the rasterize{raster} function requires it to ...
2
votes
0answers
65 views

In R: Convert from WGS84 lat/long to UTM and back again to WGS84 lat/long

I am looking for a way in R to project WGS84 latitudes and longitudes to a UTM grid and then convert the UTM coordinates back to the WGS84 latitudes and longitudes. I have found a number of ways to ...
0
votes
0answers
44 views

Clipping raster without create new table in PostGIS?

I'm learning about PostGIS, and I would like to create a SQL to cut a raster with a shapefile to work in my R program. I managed creating a new table, but I would like build it without a new table. ...
1
vote
0answers
69 views

Visualizing shapefiles on web using SHINY package of R with PostGIS?

I am using PostGIS database to store my shapefiles. Now I want to read those files through shiny package of R. How can I visualize those files on web using shiny package of R and perform statistical ...
2
votes
1answer
56 views

Trouble adding proportional circles on top of symbolized polygon in ggplot2 map

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. Per the ...
1
vote
1answer
42 views

How to create custom discrete color scheme for polygon attributes in ggplot2?

Back again with more questions. :) 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. As ...
1
vote
2answers
71 views

Vector to raster conversion [solved]

I'm using GRASS but, in case, I'm also familiar with R and QGIS. I'm trying to convert a vector area map into a raster one. My problem is that the resolution of the raster is too low (and I can't ...
4
votes
1answer
62 views

Buffer from Point or Polygon with Information from Raster

The intent of this work is to define a buffer around a point or polygon based on information from a raster. For instance if a polygon representing a city and the raster defines how long it takes to ...
2
votes
0answers
49 views

Doing spatial regression using big data when Spatial weight matrix is too large for R?

I am currently doing an analysis on a quite huge data set - 250,000 polygons. I have figured out the general Moran's I for a linear model, but when I was trying to do a spatial lag or spatial error ...
5
votes
0answers
87 views

How to display wind data in R with the leaflet package

I have some data like this : longitude latitude speed direction 1 6.10722222 46.23639 4 360 2 6.95416667 43.54694 4 360 3 7.21472222 43.66556 ...
2
votes
1answer
51 views

Round() does not return an integer raster in R

I want to convert the datatype of a raster to integer. For example: x <- raster(nrow=10,ncol=10) its datatype is float dataType(x) [1] "FLT4S" then I round the pixel values of x by y <- ...
1
vote
0answers
57 views

Automatically filling contours by different type of hatching?

I applied a question a few days ago here Filling contour levels with grain (texture) using Leaflet, I still found no answer I try to well exposed the problem here again in another way. if we have a ...
1
vote
2answers
64 views

Error Trying to Run R Summary Statistics in QGIS 2.12.1

When I try to run the R script "Summary statistics" in QGIS 2.12.1 on a Windows 7/64 bit machine, I get the error message "error in if (!file.info(DSN)$isdir) DSN missing value where TRUE/FALSE ...
0
votes
2answers
79 views

GlobCover 2009 dataset - importing legend and colormap values into R

Does anyone know how to import a legend for a raster layer (loaded as a .tif) into R such that it can be attached to the raster file itself and used in plotting? In this case, I am using the GLC2009 ...
0
votes
1answer
812 views

R custom color theme in levelplot

R range(diffRain) [1] -2.59 7.59 How can I code a color ramp following ways? red color ramp less than 0.0 blue color ramp greater than 0.0 This is a part of my code. myTheme <- ...
6
votes
2answers
588 views

Using rpy2 in ArcGIS

I have a 3rd party python geoprocessing script that requires rpy2, and thus also r. What is the best way to get these working together? Using R with ArcGIS Desktop says the most useful option for ...
4
votes
2answers
50 views

Add a point on a spplot in R

I have to add a point on a existing spplot in R. I need it only for a visual purpose. I have the coordinates of the point, but I don't know how to change the code in order to add the point. This is ...
1
vote
1answer
185 views

Filling contour levels with grain (texture) using Leaflet

I created a program to draw temperature contour map of France: This is the code: library(ggplot2) library(gstat) library(sp) library(maptools) require(rgeos) library(rgdal) library(foreign) ...
3
votes
1answer
55 views

What is faster - a matrix, raster or a dataframe?

I have rasters over which I am performing mathematical operations. For example, where I need to calculate flow distance or distance between two grid points. What format is generally considered faster ...
13
votes
3answers
6k 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 ...