[R-sig-Geo] zonal statistics as table

Jens Engelmann (jengelmann@cgdev.org) jengelmann at cgdev.org
Sun Sep 28 16:16:35 CEST 2014


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



More information about the R-sig-Geo mailing list