[R-sig-Geo] how to read in R a big raster of about 6 Gb

Dominik Schneider Dominik.Schneider at colorado.edu
Thu Oct 15 17:26:27 CEST 2015


You can use the raster package,  which will leave the values on disk if
they are too big for memory.
Use the function raster() to read the DEM, then use readOGR() to read the
polygon shape file. You can then use extract() to get statistics on your
DEM. I'm guessing it'll take a while to extract from disk, so if you are
planning to extract multiple times, you should consider copying your DEM
and setting the values equal to the cell numbers with values(DEM) <-
1:ncell(DEM).  Extract this once, keep track of which cell numbers are in
which polygon and then use the cell numbers to index the DEM when you need
values by polygon.
Hope this helps,
Dominik


On Thu, Oct 15, 2015 at 9:07 AM, Massimo Bressan <mbressan at arpa.veneto.it>
wrote:

> hi all
>
>
> I need to perform a zonal statistics by overlapping a DEM raster (ESRI
> grid binary) with some polygons (ESRI polygons);
>
> the problem is that I first of all need to read the raster, which is
> quite big: about 6 Gbyte;
>
> I know about the function readGDAL() by the fantastic package "rgdal"
> which is usually working very well with smaller size files but this time
> I got completely stuck (the pc freezes invariably)
>
> do you have any advice on how to deal with such a problem (big file)?
>
> thank you
>
> regards
>
> _______________________________________________
> 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