Dear list,
thank you very much for all the many suggestions on how to extract values to
points! I ended up using the RSAGA package with the pick.from.ascii.grid()
function.
Cheers,
Frauke
> Date: Tue, 10 Mar 2009 20:19:17 +0800
> Subject: Re: [R-sig-Geo] extract values to points
Just for the record. this is how I would do this with the raster
package (Kamran's example should work, but seems a bit unnecessarily
complex; just what we are trying to avoid with that package :):
install.packages("raster", repos="http://R-Forge.R-project.org";)
library(raster)
xy <- your matrix
Hi,
Funny to see how you can do things in multiple ways in R :). To add to
the possibilities, you could probably also get this functionality using
R and Grass.
I would personally recommend to use overlay() as you don't have to
install anything apart from the sp package, unlike using rsaga an
Hi,
An option using only R is to use the overlay() command from the sp
package, try running this example:
# Load data
library(sp)
data(meuse)
# point data
coordinates(meuse) = ~x+y
data(meuse.grid)
# grid data
gridded(meuse.grid) = ~x+y
overlay(meuse.grid, meuse)
# Returns the indices in meus
Hi Frauke,
in the RSAGA package there is a function pick.from.ascii.grid which does
exactly what you want. Even works with large grids as it can process
them row by row. I use it for extracting point data from stacks of
Landsat bands, terrain attributes etc.
Here a case study (landslide suscepti
Dear list,
I have a soilmap as an Ascii grid and a dataframe with x and y coordinates
(these are sampling points). I would now like to extract values from the
soilmap to the dataframe based on location, the x and y values. Is there any
way to do this in R?
Cheers,
Frauke
_