[R-sig-Geo] Raster to points

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Apr 21 21:51:20 CEST 2012


On Sat, Apr 21, 2012 at 3:21 PM, Tim Appelhans <tim.appelhans at gmail.com> wrote:
> The 'over' function in the sp package should do what you are after.

 Except the function doesn't apply to rasters, by which I mean objects
from the raster package.

If you have:

dem = raster("dem.tif")
pts = readShapeSpatial("pts.shp")

then extract(dem,pts) will return the values of the dem raster at the
locations of  the points in pts.

No need to use GRASS or QGIS for this.

Barry



More information about the R-sig-Geo mailing list