An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130205/ff17d145/attachment.pl>
Reprojecting a categorical raster using something besides nearest neighbor
5 messages · Jonathan Greenberg, Edzer Pebesma, Robert J. Hijmans
Jonathan, perhaps use function(x) which.max(table(x)) as the aggregate function?
On 02/05/2013 09:28 PM, Jonathan Greenberg wrote:
R-sig-geo'ers: I'm trying to figure out an efficient way to upsample (from higher rez to lower rez) a *categorical* raster using a function where the output pixel value is the ID of the class that would have had the highest cover within the output, given the resampling. This is NOT the same as a nearest neighbor function. Right now, the best I can think of is: 1) Generate a set of binary masks, one per class, of the input image, where for class X, the image X will be 0 if class X is not present, and 1 if it is. 2) Run aggregate() with a function mean() on these images. 3) Pick the max value across the aggregated, lower rez images, which should be the class with the highest cover. Is there any easier way to do this? --j
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130205/d1014340/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130205/f9bc0129/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130205/e23b6d36/attachment.pl>