[R-sig-Geo] Selecting a raster cell which contains a point of given coordinates
Robert Hijmans
r.hijmans at gmail.com
Fri Feb 18 18:29:44 CET 2011
> Hi all,
> I have a raster file read by:
> Map=readGDAL(paste("C:/Temperature/HDF/TERRA/TIF/Terra.",datesMOD11A1[d],".LST_Day_1km.tif",sep=""))
>
> and a point coordinates like:
>
> Gattia=matrix(c(x=13.66966,y=42.63941), ncol=2)
> Gattia=project(Gattia,proj4string(Map))
>
> I would like to know which is the cell in the Map that contains the
> coordinates of the point named Gattia.
Luca, you can do:
library(raster)
r <- raster(Map)
cellFromXY(r, Gattia)
Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Selecting-a-raster-cell-which-contains-a-point-of-given-coordinates-tp6039068p6040813.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list