See coordinates vector in raster
You can just do xy <- coordinates(r1) which gives a 2-column matrix with lon <- xy[,1] lat <- xy[,2] Note that for largish rasters this is a considerable amount of data, and it's mostly all redundant since you can generate it from the resolution and extent, so you might need to consider other options. Cheers, Mike. On Wed, Jan 23, 2013 at 10:55 AM, Thiago V. dos Santos
<thi_veloso at yahoo.com.br> wrote:
Dear all, Is there any way to access the vector containing the longitude and latitude coordinates of a raster object? For example: library(raster) r1 <- raster(nrows=800, ncols=820, xmn=0, xmx=10) # I am looking for something like this: r1$lon r2$lat Thanks in advance, Thiago.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Michael Sumner Hobart, Australia e-mail: mdsumner at gmail.com