[R-sig-Geo] zonal statistics as table
Michael Treglia
mtreglia at gmail.com
Mon Sep 29 06:16:49 CEST 2014
I've had the same experiences as described above... Depending on exactly
what stats you need to calculate, you might want to check out SAGA GIS (
http://saga-gis.org/). I've generally found it to work great on giant
rasters, though you might hit a limit depending on your hardware. The tool
you'd look for is in Shapes-Grid -> Grid Statistics for Polygons.
Alternatively, I've had some success with PostGIS - this code was designed
to give counts of unique pixel values within polygons:
https://github.com/RENCI-Ecohydro/OSS-2014/blob/master/Scripts/Database_PostGIS_Analyses_MLT.txt
Sorry that's not an R answer (:-\), but hope it helps.
Mike
On Sun, Sep 28, 2014 at 9:16 AM, Jens Engelmann (jengelmann at cgdev.org) <
jengelmann at cgdev.org> wrote:
> Hi Joseph,
>
> I faced a similar problem at my current work. I do not believe that R
> currently has a solution to efficiently calculate raster stats on such a
> large dataset. Instead, I would look at the raster_stats utility in python:
>
> https://github.com/perrygeo/python-raster-stats
>
> I found this module to be extremely efficient and you can pipe the results
> into R to work with afterwards.
>
> Cheers,
> Jens
>
> Jens Engelmann
> Research Assistant
> Center for Global Development
> Independent Research & Practical Ideas for Global Prosperity
> Phone: 1 202 416-4027
> Email: jengelmann at cgdev.org
>
> ________________________________________
> From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org]
> on behalf of Forrest Stevens [forrest at ufl.edu]
> Sent: Saturday, September 27, 2014 6:05 PM
> To: Joseph Bechara
> Cc: R-SIG list
> Subject: Re: [R-sig-Geo] zonal statistics as table
>
> Hi Joseph.. With datasets that large, in my experience you're looking at
> spatial subsetting to get something manageable and I've given up on zonal()
> as it's just too slow for my needs. Rather, I would do your own feature to
> raster conversion on the polygons based on the raster layer so cells
> overlap exactly, then for your subsets convert the data to data.table
> objects and run your aggregations using that very fast package.
>
> When it comes to zonal statistics R is just a bit cumbersome for anything
> larger than the smallest datasets. I'd be happy to hear anyone else's
> thoughts and be corrected if there's a more efficient way to do it!
>
> Sincrerly,
> Forrest
>
> --
> Forrest R. Stevens
> Ph.D. Candidate, QSE3 IGERT Fellow
> Department of Geography
> Land Use and Environmental Change Institute
> University of Florida
> www.clas.ufl.edu/users/forrest
>
> On Sat, Sep 27, 2014 at 3:41 PM, Joseph Bechara <jbechara at lri-lb.org>
> wrote:
>
> >
> > Dear all,
> > I'm looking for a R code that do the same work of "zonal statistics as
> > table" of ArcIS.I found that the function zonal can do it but the issue
> is
> > that I have large inputs raster and polygons.I'll appreciate if somebody
> ca
> > help me.
> > polygons layers contains 9 millions rowsraster is 30 Gb
> > Regards,
> >
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list