I think you can do this in two steps. First do projectRaster with nearest
neighbor to a high resolution longlat raster (e.g. 1/480 degrees) that can
then be aggregated to .5 degrees. Alternatively (faster, but perhaps less
precise?) you could first aggregate ~230 times and then use projectRaster.
Robert

On Tue, Feb 5, 2013 at 4:31 PM, Jonathan Greenberg <jgrn@illinois.edu>wrote:

> This is possible, but there is another issue I'm now realizing -- I
> actually want to reproject from Albers Equal Area at 250m to Geographic
> (WGS-84) at 0.5 degrees -- AFAIK aggregate is only used to change pixel
> size by certain factors, not to reproject.  I'd have to pick some factor
> that is close to a mean degree (this is a global data set, not a small
> localized one), then try to reproject that afterwards.
>
> Right now the best solution I can think of is first vectorizing the
> categorical raster (a 3gb raster file), reprojecting the vector file to
> Geographic, then rasterizing the vector.  This seems a pretty inefficient
> way to do this, but I'm not seeing a clean way to do this any other way.
>  As a note, I can't find any evidence that this can be done in GRASS, QGIS,
> ENVI, or ArcGIS either.
>
> --j
>
>
> On Tue, Feb 5, 2013 at 2:52 PM, Edzer Pebesma <
> edzer.pebesma@uni-muenster.de
> > wrote:
>
> > 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<
> http://www.52north.org/geostatistics>
> > e.pebesma@wwu.de
> >
> > ______________________________**_________________
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
> >
>
>
>
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
> Department of Geography and Geographic Information Science
> University of Illinois at Urbana-Champaign
> 607 South Mathews Avenue, MC 150
> Urbana, IL 61801
> Phone: 217-300-1924
> http://www.geog.illinois.edu/~jgrn/
> AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307, Skype: jgrn3007
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

