Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

Statistical computing language and software environment.

6
votes
4answers
6k views

Dissolving ploygons in QGIS or Grass to new polygons of defined population sizes?

I have a shapefile with 3800 polygons representing the smallest administrative areas in Ireland. Many of these, in rural areas, have tiny populations, under 100 people. In urban areas, all would have ...
15
votes
5answers
13k views

How to split a vector into equal smaller parts in QGIS or similar?

i want to divide a shapefile with many tiles into a lot of smaller tiles. I am searching for a smart solution, because manual edits are out of questions Anyone can help or know a nice function?
19
votes
4answers
4k views

How can I generate irregular grid containing minimum n points?

Given a large (~ 1 million) sample of unevenly distributed points - is it possible to generate irregular grid (in size, but could also be irregular in shape if that is possible?) that will contain ...
22
votes
3answers
10k views

Performing Raster Noise Reduction and Edge Smoothing?

I have a raster image like this I want to delete the isolated noise point and smooth the edge (say the white single points, and I want the edges of the entity look smooth). How can I do this in ...
31
votes
3answers
14k views

How to perform Random Forest land cover classification?

This is a follow-up to a previous post: Machine Learning Algorithms for Land Cover Classification. It seems that the Random Forest (RF) classification method is gaining much momentum in the remote ...
33
votes
2answers
51k views

Projecting sp objects in R

I have a number of shapefiles in different CRSs (mostly WGS84 lat/lon) that I'd like to transform into a common projection (likely Albers Equal Area Conic, but I may ask for help on choosing in ...
39
votes
2answers
37k 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 -120....
36
votes
5answers
20k views

How best to fix a non-noded intersection problem in PostGIS?

I'm using a PL/R function and PostGIS to generate voronoi polygons around a set of points. The function that I am using is defined here. When I use this function on a particular dataset I get the ...
12
votes
2answers
14k views

Calculating shortest distance from point to line using QGIS?

What is the best method to calculate the distance from the nearest road for a series of address points in QGIS, having a very big dataset? (QGIS 2.0.1, Win XP) I read the answers to previous similar ...
14
votes
3answers
1k views

Determining if trees within forest gaps are clustered using R?

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. ...
22
votes
3answers
5k views

Using R with ArcGIS Desktop?

I've used the integration of R with QGIS, and found it a very uesful tool. Having taken a look at the R toolbox extension for 9 and the extension for 10 it appears they both offer only point ...
10
votes
3answers
14k views

Counting number of points in polygon using 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 ...
9
votes
4answers
4k views

Assigning RGB values from Geotiff image to LiDAR data, using R

I have given a Geotiff image and its corresponding Lidar data (x,y,z) in UTM coordinates. I need to merge the Lidar data with the RGB values from the image. That means, at the end, I need to plot (...
13
votes
2answers
4k views

Clip polygon and retain data?

I have these two polygons: library(sp); library(rgeos); library(maptools) coords1 <- matrix(c(-1.841960, -1.823464, -1.838623, -1.841960, 55.663696, 55.659178, 55.650841, 55....
4
votes
3answers
6k views

How do I plot points as graduated/proportional circles in R?

I'm back again with more R mapping questions! This one is concerning symbolizing points by a certain attribute with graduated/proportional circles. DATA: My full code can be found here if you're ...
6
votes
1answer
8k views

Assigning CRS to shapefile when it doesn't have one, in R?

I think that by using readOGR to import a shapefile renders worthless to put proj4string to the script since if any coords are available in the shapefile, it will be transported through the readOGR. ...
44
votes
11answers
10k 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 ...
60
votes
6answers
139k views

Opening shapefile in R? [closed]

I need to open a shapefile from ArcMap in R to use it for further geostatistical analysis. I've converted it into ASCII text file, but in R it is recognized as data.frame. Coordinates function doesn't ...
32
votes
4answers
22k views

Overlay a spatial polygon with a grid and check in which grid element specific coordinates are located

How can one use R to split a shapefile in 200 meter squares/sub-polygons, plot this grid (incl. ID numbers for each square) over the original map below, and evaluate in which square specific ...
32
votes
2answers
54k views

Clipping a raster in R

I am building a map for the northeastern U.S.A. The map background needs to be either an altitude map or a mean annual temperature map. I have two rasters from Worldclim.org which give me these ...
16
votes
2answers
28k views

Extracting intersection areas in R

I have two polygons. One contains fields(X,Y,Z) and the other contains soil types (A,B,C,D). I want to know what area of every field contains which type of soil. I tried the following: library(rgdal)...
27
votes
1answer
15k views

How to read feature class in file geodatabase using R?

I have a feature contained in a geodatabase that is larger than 2GB as an exported shapefile. I need to run an extract function in R to attribute the polygons with data from a raster file. Exporting ...
15
votes
2answers
16k 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 ...
18
votes
2answers
28k 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 ...
14
votes
6answers
5k views

Convert line shapefile to raster, value=total length of lines within cell

I have a line shapefile representing a road network. I wish to rasterize this data, with the resulting values in the raster showing the total length of the lines that fall within the raster cell. The ...
9
votes
1answer
3k views

Processing vector to raster faster with R

I am converting vector to raster in R. However the process was too long. Is there possibility to put the script into multithread or GPU processing in order to do it more faster? My script to ...
14
votes
7answers
3k views

How to implement value-by-alpha map in GIS?

I've been doing some background reading about cartograms recently and stumbled upon interesting alternative - value-by-alpha maps. Concept is described in more details here and full paper is ...
12
votes
3answers
4k views

Reverse clipping (erasing ) 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. ...
10
votes
1answer
1k views

How to visualize azimuthal data with uncertainties?

I am trying to make a figure showing azimuthal data with a different range of uncertainties at each point. This oldschool figure from a 1991 paper captures the "bowtie plot" idea that I'm aiming for: ...
5
votes
2answers
861 views

Retrieving LiDAR metrics from relative vertical layers of point cloud?

I need to obtain the proportion of all returns within 5 equally spaced height bins between the cutoff (1 meter) and the maximum height value. I need to get this proportion of all returns for 1000 ...
29
votes
5answers
15k views

Increasing speed of crop, mask, & extract raster by many polygons in R?

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 ...
21
votes
2answers
14k views

Instantiating spatial polygon without using a shapefile in R

So, the usual way we read a shapefile in R is via the maptools package, like this: sfdata <- readShapeSpatial("/path/to/my/shapefile.shp", proj4string=CRS("+proj=longlat")) However, I have a use ...
17
votes
6answers
2k views

What are sources for current geo-statistical analysis classes/events: open or proprietary

I am keenly interested in geo statistics (and many other words with 3 t's :). I am not very programatically inclined but have been following several lists with this theme. One being the R filter on ...
28
votes
2answers
32k 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 ...
39
votes
4answers
27k views

Reading 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 ...
13
votes
2answers
31k views

How to extract values from rasters at location of points in R?

My question is about extracting values from rasters at the location of points. With the function extract this is very easy, and the function gives me a dataframe with the values of all the variables ...
15
votes
1answer
4k views

Batch geocoding in R

I need to find a package in R or source code in R that performs batch geocoding using Bing, Yahoo, OpenStreetmap. Do you have any suggestions?
7
votes
2answers
2k views

Clipping vs Intersecting

I was curious why clipping shapefiles was just so difficult and whether it was different to intersecting shapefiles? You will see from one my questions that I gave up trying to clip a polyline with a ...
7
votes
2answers
6k views

How to calculate area of 1 x 1 degree cells in a raster

I have a simple array (not geo-referenced in any way) in Matlab (which is not a language I know a huge amount about...so I can export it to other languages if needed) which has the dimensions 180 x ...
16
votes
7answers
9k views

Get Raster Values from a Polygon Overlay in Opensource GIS Solutions

I have two layers. A polygon-shape-layer with many tiles and a raster-layer containing CORINE 2006 land cover with many categories in a colourmap. I want to obtain for each polygon in the shapelayer a ...
8
votes
1answer
5k views

Fill the gaps using nearest neighbors

I want to fill the NA values using the average values of the nearest neighbors: r <- raster(matrix(1:16, nrow=8, ncol=8)) r[r==12] <- NA
4
votes
4answers
1k views

Lines on reprojected sp objects with Mollweide projection

I'm having an odd problem such that when I reproject maps to a Mollweide projection in R using sp, I get additional lines stretching across the globe. What is going on here, and do you have any ...
11
votes
3answers
4k views

Rgeos drops associated values when intersecting polygons

I am trying to intersect two SpatialPolygonsDataFrames and get a SpatialPolygonsDataFrame as the result. Unfortunately, using the gIntersection function from rgeos (which works impressively quickly ...
7
votes
1answer
9k views

ggmap: create circle symbol where radius represents distance (miles or km)

I am trying to add a circle around a given latitude and longitude point where the circle size (radius) reflects distance in miles or km. I managed to come up with this example using ggmap, where I ...
7
votes
1answer
9k views

Replace NA's with 0 for raster data using R?

I am new in R. How can I replace NA's with 0 for my raster data which have spatial information?
7
votes
2answers
4k views

Open JPEG2000 (Sentinel 2) in R

Is there any way I can open Sentinel 2 JPEG2000 file (.jp2) using R? Or more specifically with the {raster} package in R? I keep getting the Error message that .jp2 is: not recognised as a ...
5
votes
2answers
3k views

How to calculate distance from POINT to LINESTRING in R using `sf` library and get all POINT features from LINESTRING where distances were calculated?

I'm trying to calculate distances from a set of POINT features (1, 2, 3, 4, 5, 6 & 7) to a LINESTRING feature using sf library in R. I could calculate all the distances using the function ...
3
votes
1answer
569 views

MOD09A1 QC layer

Does anyone know how to handle MOD09A1 Quality flags (QC) in in R? I was trying to use raster package but unable to unlock the QC band.
1
vote
1answer
3k 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<-...
32
votes
2answers
6k views

How can I conduct Geographically Weighted Principal Component Analysis using ArcGIS, Python and SPSS/R?

I am after a description/methodology for conducting a Geographically Weighted Principal Components Analysis (GWPCA). I am happy using Python for any portion of this and I imagine SPSS or R being used ...