An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090305/9d095127/attachment.pl>
extract values to points
3 messages · Frauke Barthold, Alexander Brenning, Paul Hiemstra
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 susceptibility modeling): http://www.environment.uwaterloo.ca/u/brenning/Brenning-2008-RSAGA.html also available as pdf: http://www.environment.uwaterloo.ca/u/brenning/Brenning-2008-RSAGA.pdf I hope this helps Cheers Alex
Frauke Barthold wrote:
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
_________________________________________________________________ [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Alexander Brenning brenning at uwaterloo.ca - T +1-519-888-4567 ext 35783 Department of Geography and Environmental Management University of Waterloo 200 University Ave. W - Waterloo, ON - Canada N2L 3G1 http://www.fes.uwaterloo.ca/geography/faculty/brenning/
4 days later
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 meuse.grid correpsonding to the points in meuse # get the data from meuse.grid, for example the column "dist" # a non spatial vector dist = meuse.grid$dist[overlay(meuse.grid, meuse)] # A spatialPointsDataFrame dist = meuse.grid[overlay(meuse.grid, meuse), "dist"] Also check out the rgdal pacakge to get your data into R-spatial objects. cheers, Paul
Frauke Barthold wrote:
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
_________________________________________________________________ [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul