[R] [R-sig-Geo] clipping a large image on R

Roger Bivand Roger.Bivand at nhh.no
Fri Jan 11 18:47:23 CET 2008

On Fri, 11 Jan 2008, Henrik Bengtsson wrote:

> Try the EBImage package (utilizes ImageMagick and is available via
> Bioconductor.org) - not sure if it well help though.  If not, try to
> clip the larger image by calling ImageMagick outside R.

First, please only write to one list at a time - this reply to both to 
continue thread.

Please read the documentation in the rgdal package properly, then on the 
format (unknown) that your data are in on www.gdal.org if necessary. Use 
the arguments to readGDAL() or asSGDF_GROD() in ?readGDAL, and/or 
getRasterData() or getRasterTable() in ?"GDALRasterBand-class", most 
likely offset= to offset the origin in rows and columns, and region.dim= 
to set the numbers of rows and columns to access.

You should be able to work out the ones you need from the smaller image 
that you can read. The GDALinfo() function should give you enough 
information on the larger file to help set up offset= and region.dim= - if 
resampling is needed, use output.dim= as well. If you have multiple bands, 
you can choose those too.


> /HB
> On 11/01/2008, Milton Cezar Ribeiro <milton_ruser at yahoo.com.br> wrote:
>> Dear all,
>> I have a so large image (43,000 x 18,000 pixels) and I need clip this 
>> image with a smallest one (1000x1000 pixels). I can read the second 
>> image using rgdal package. But the first image can´t be read on my 
>> system because if memory limitation (I have about 2GB availabe).
>> So I would like hear from you if anyone have some suggestin in this regards. I have also ArcGis 8.6 ans Erdas 8.3 running on my system and I can read the largest file without problem. But I dont know how clip the large image to keep only those pixels that math to he smallest image coordinates.
>> kind regards, miltinho
>>  para armazenamento!
>>         [[alternative HTML version deleted]]
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-help mailing list