[R-sig-Geo] Looping through pixels in a SpatialGridDataFrame

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Dec 22 15:24:38 CET 2011



On 12/22/2011 02:26 PM, jjcabrera20 wrote:
> Thanks Jan
> I will take a look on the links.
> But any way there is a method to loop inside a SpatialPixelDataFrame?

You can address individual pixels, as in:

library(sp)
loadMeuse()

gridded(meuse.grid)
class(meuse.grid)

meuse.grid[10,] # pixel 10
meuse.grid[10,][["dist"]] # attr "dist" for pixel 10

for looping over rows and columns, you'd like to convert to
SpatialGridDataFrame, as in:

fullgrid(meuse.grid) = TRUE
meuse.grid[50:51,50:51] # select a region defined by row/col ranges
meuse.grid[50,50] # which should work, but doesn't for some reason.

> 
> 
> Best,
> 
> Jorge
> 
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Looping-through-pixels-in-a-SpatialGridDataFrame-tp7113726p7118612.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list