Statistical computing language and software environment.

learn more… | top users | synonyms

3
votes
1answer
59 views

How to plot a full hemispheric orthographic projection in R

I want to make a plot like that using R: All I want is the country borders as seen from outer space, no fancy colors needed. It seems I need to use the spTransform function, but it gives me a "non ...
1
vote
0answers
23 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 ...
0
votes
1answer
73 views

calculate distance between points crossing the antimeridian

How can I calculate the distance between two points (lon/lat) if any of the points exceeds the antimeridian (+-180 longitude)? Im using the distVincentyEllipsoid {geosphere} to calculate the shortest ...
4
votes
1answer
125 views

Fixing orphaned holes in R

I'm trying to perform a union on a common field after merging two adjacent shapefiles. The shapefiles end up with at least one thin sliver of space between them. When I attempt a union I get the ...
2
votes
2answers
92 views

Convert shapefile with lists to data frame in R

I would like to ask some help for converting a shapefile to data frame. I downloaded data related to roads from Natural Earth. I imported the shapefile using shapefiles package like the following. ...
1
vote
1answer
47 views

How to convert raster to im object for point process model covariate in R

I am trying to convert a raster object to an .im object for use with a point process model in the spatstat package in R. I begin by creating the raster from a tiff file using the raster() package. No ...
1
vote
0answers
81 views

Using r, readShapeSpatial fails with simplified mapshaper.org shape

So I'm mapping out the postal regions of my country and it's an enormous, 5.4million row dataframe. I don't need every single little twist and turn of the boundries, so I was super excited to ...
1
vote
1answer
109 views

How to find highest kernel density point

I've been using spatstat to analyse point patterns in R. Here's an example to put this in context: library(spatstat) library(maptools) # to convert sp class to ppp Some point data: set.seed(1985) ...
0
votes
1answer
63 views

Subset netCDF based on last valid variable by level

I have a netCDF file (in this LINK) which contains monthly average values for 4 parameters at 11 different depth levels (0-200m). I would like to extract the monthly value for temperature "votemper" ...
2
votes
1answer
805 views

GDAL loads in Python, but not IPython (Linux)

I am trying my hardest to utilize the work of the good folks at the GeoDa center, but I cannot seem to get all of the components to load. GDAL, in particular, has been giving me some difficulty. The ...
1
vote
2answers
129 views

Transforming and Projecting Shapefiles in R & ArcGIS for Desktop?

Perhaps this is an issue with one of my original data sources, but I've searched extensively to address this problem both through ArcGIS and R. I've got 2 separate sources of a county layer SourceA ...
3
votes
0answers
47 views

Resampling air temperature gridded data to sub-grid resolution

I'd like to obtain a 30-m resolution gridded dataset of air temperature from the ~1km gridded data of WorldClim, of Hijmans et al., 2005) for a mountainous region. The easiest procedure (I thought ...
1
vote
0answers
28 views

How to convert shapefiles to rasters? [duplicate]

I have my environmental variables such as elevation, soil, vegetation and others as shape-files. I want to use a raster command to upload them as tiff files for running a boosted regression tree in ...
3
votes
3answers
478 views

Per-pixel (statistical) calculations on a raster stack using GDAL

In R, it's relatively trivial to perform per pixel calculations based on a raster stack (e.g., get std.dev for each pixel on a 12 layer GeoTIFF). Unfortunately, the speed is less than desirable when ...
1
vote
1answer
125 views

How to open and plot Globcolour chlorophyll image in R?

Level 3 globcolour chlorophyll images (download from hermes) are in netCDF format. Those files can be imported via ncdf package to R 3.1. ch.nc = ...
0
votes
0answers
45 views

R PostGIS convert SpatialPolygon to PostGIS table

I've been having some success in scraping some webdata and converting it from HTML to spatial data as originally asked here: Parse PHP/HTML to shapefile or similar I've been using R to both fetch the ...
1
vote
1answer
48 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 ...
3
votes
2answers
111 views

How to iterate through features in a shapefile using R?

I am interested in iterating through a point shapefile to perform tasks on a point by point basis using R. In Python, this can be accomplished using the following workflow: import arcpy shp = ...
1
vote
1answer
77 views

Problem in creating neighbors, area and perimeter in spatial econometrics using R

I’m working on a spatial cross section model with R-programming-language. I’m running these codes which refers to anselin data (spatial_columbus) in spdep package. I found them from these links: ...
0
votes
0answers
33 views

Doing joint hypothesis test in spatial regression using R?

I'm doing estimation of spatial lag/error model using R package "spreg"/"spdep" but I cannot find any method to do anhypothesis test after regression. For example, I want to test whether two ...
5
votes
2answers
626 views

Reduce the resolution of a shapefile in R (or QGIS if necessary)

I'm using shapefiles of history U.S. state boundaries from NHGIS to make maps in R. These shapefiles are much higher resolution than I need when making maps at the scale of the country: over 2 million ...
4
votes
1answer
120 views

Why covariance values are different in R and ArcGIS?

I've calculated covariance between 7 rasters using R and ArcGIS. It gives me different results. Each times covariance values from R are approximately 1.874 times higher than ArcGIS values. R - ...
6
votes
1answer
420 views

Route analysis in R based on the OSM transport network: possible?

I'm analysing the likely paths taken by commuters on their way to work, based on Census flow data, job density distributions and the transport network. At the moment I'm using pgRouting and the ...
8
votes
2answers
1k views

How to Find the Average Raster Value of an area defined by a shapefile using R?

I have a set of raster images which represent a specific month over the years, and I want to make a timeline of the average values of an area using a shapefile. How do I extract the values from the ...
1
vote
2answers
153 views

Avoiding R for windows gui front-end has stopped working error?

I am trying to load huge number of points (shape file) in R. But when I load it, the program displays following error message and just stops. "R for Windows GUI front-end has stopped working" My OS ...
2
votes
1answer
60 views

How to create header files for multiple rasters in R

I have nearly 1000 generic binary images, i.e., headerless, band sequential and binary (16-bit signed integer). I have been succesfully able to load these with package 'raster' only when I create an ...
0
votes
1answer
121 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
49 views

Adding a grid and selecting random cells from spatial polygon in r

I have a fairly similar question to this: Similar Question I am working with a map of Denmark or more a subset of a Denmark Map. This file comes from the Global administrative areas site GADM site ...
2
votes
2answers
441 views

Iterating polygons on a SpatialPolygonsDataFrame in R with readWKT

I have fetched some data (39 objects) from my PostGIS database and converted this data into a matrix: rs <- dbSendQuery(con, "SELECT ST_AsText(polygon_accumulation) AS ShapeWKT from ...
0
votes
1answer
59 views

How to get specific coordinate system to get arcGIS point shapefile in r?

I have a Point shapefile from arcGIS 10. I want to get it in r and also want to get it a specific predefined coordinate systen for my data. I can read the shapefile in R but summary in r Shows ...
0
votes
1answer
79 views

Extract single datapoint from netCDF file in R using ndcf

I'm trying to extract a single variable from a 3-dimensional netCDF file. [1] "file blah.nc has 3 dimensions:" [1] "longitude Size: 200" [1] "latitude Size: 100" [1] "time Size: 2000" [1] ...
17
votes
2answers
5k views

How can I convert data in the form of lat, lon, value into a raster file using R?

I have a data set of values over a km grid in the continental U.S. The columns are "latitude", "longitude", and "observation", e.g.: "lat" "lon" "yield" 25.567 -120.347 3.6 25.832 ...
4
votes
1answer
97 views

Convert ESRI Shapefile to Raster using R - biggest polygon area to raster cell value?

I want to create a raster from an ESRI shapefile. Multiple polygons may exist in one raster cell. If so, I want to assign the attribute variable which occupies the biggest area of the raster cell. ...
4
votes
2answers
65 views

Map location of unknown point with distances to two known points

I'm trying to develop a function in R that will locate a point (A) on a map given distances between that point A and two other points (B and C), for which exact coordinates are known. The problem I'm ...
3
votes
2answers
50 views

Counting number of points in particular polygon for list of individuals using R?

I have distribution points for a set of individuals and a file of polygons-with matching IDs. What I would like to do is to go through and for each individual find the total number of points and the ...
1
vote
1answer
79 views

(R)SAGA: saga_cmd 2.1.0 error? inconsistency?

frequently I am using (R)SAGA, but after SAGA became >2.1.0 the R package is no longer working. The last update for RSAGA was 07/2013. Thus I downgraded SAGA to 2.1.0 (first try was skipping the ppa ...
2
votes
0answers
152 views

Moving point on OpenStreetMap route

Basically I generate random numbers in R language which are indeed times between bus arrivals. I need to simulate a moving point(a bus) in OpenStreetMap by using this generated numbers. I have read ...
1
vote
0answers
54 views

Rounding off coordinates in an SpatialPolygonDataFrame in R

EDIT AFTER COMMENTS After a comment of Whuber (Thank you!) I realized it will probably be most easy to incorporate a round(...) statement within my code to be able to work with less decimals. ...
0
votes
1answer
31 views

How to batch export using r.out.gdal command in GRASS

I created a list of files (NPPFILES) using g.mlist command in GRASS 7. Now I would like to export these files as .tiff files. I tried this command in GRASS prompt for files in $NPPFILES; do ...
2
votes
2answers
227 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 ...
1
vote
0answers
56 views

Calculating surface and lines in 3D projection in R

For my internship research I am trying to compare the surfacearea and length of geometric shapes and lines in one coordinate system to another. I have a SpatialPolygonDataFrame in the European equal ...
0
votes
0answers
38 views

How to reference a number variable in r.mapcalc within QGIS graphical modeler

I need to run the following formula in r.mapcalc: (xor(abs(A-B),abs(A-C))>120)*A I would like to however use a user defined number input variable instead of the 120. I already have this variable ...
1
vote
0answers
28 views

Calculating average raster values around set of points using ArcGIS for Desktop (or R)? [duplicate]

I have a 30-m elevation raster as well as a set of points that overlay the raster. For each point, I want to calculate the average elevation within a 5-km radius of the point. One way I was ...
2
votes
1answer
41 views

Is this a known issue in gaps between masked raster and spatial polygon in R with mask command?

This is my codes raster file: RAD polygon(shape): ws_sfc RAD.sub <- crop(RAD, extent(ws_sfc)) plot(RAD.sub) RAD.sub <- mask(RAD.sub, ws_sfc) plot(RAD.sub) plot(ws_sfc, add = TRUE) ...
0
votes
0answers
17 views

Kernel Density Analysis using R and ArcGis [duplicate]

I am doing some Kernel Density Estimations, and like everyone elese I face difficulties with setting the bandwidth to create georeferenced rasters. ArcGis (10.1) does it just fine, but it has no ...
2
votes
1answer
86 views

Plotting species distribution on map in R

I'd like to plot the distribution of a species on a map of Switzerland, following this tutorial. library(maps) library(mapdata) map('worldHires', 'Switzerland', xlim=c(5, 12), ylim=c(45,48)) From ...
1
vote
0answers
95 views

Unable to access R from QGIS 2.4

I have been unable to run R from within QGIS on my computer. I have R version 3.03 installed and QGIS 2.4 on Windows 7. R is located at C:\Program Files\R\R-3.0.3\bin\and this is the path e specified ...
1
vote
0answers
37 views

QGIS using different R lib

I am working with a colleague who is learning QGIS and has a question about the R plugin. His library path (.libPaths()) has two folders: "C:/Users/RDCERWAW/Documents/R/win-library/3.0" "C:/Program ...
0
votes
3answers
203 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 ...
2
votes
2answers
209 views

MODIS Level 1B batch process

I am a new MODIS Level 1B user. I have been using the MODIS Swath tool to process my images. However, I have over 1000 images to process. I was wondering if there a script available in IDL or R (very ...