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@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

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to