[R-sig-Geo] how to mask a raster with a coarser resolution selected grid squares ?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Sep 17 11:08:12 CEST 2010



On 09/17/2010 09:47 AM, Arnald Marcer wrote:
> Dear listers,
> 
> Can anybody help me with this ?
> 
> How can I mask a 1km UTM grid raster with a list of coordinates
> which represent the center of 10km UTM grid squares ? Ultimately
> I want the 1km grid raster with only the pixels that fall inside
> the 10km UTM grid squares.

convert the first to SpatialPointsDataFrame, and create a SpatialPixels
object from the second, then use overlay() to get the indexes of the
points that lie within the 10km grid cells.
> 
> Also, how can I build a SpatialPolygonsDataFrame representing 10km
> UTM grid squares from a list of coordinates which represent their grid
> center.

first create a SpatialPixelsDataFrame, say sx, then use

as(sx, "SpatialPolygonsDataFrame")

> 
> I will appreciate if you can give me some hints on how to do this.
> 
> Arnald Marcer
> CREAF
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> 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