[R] Failed to open *.img in rgdal

Michael Sumner mdsumner at gmail.com
Thu May 16 13:34:12 CEST 2013


Not really "in one go", but, R has basic string functions and looping.
See ?list.files, ?file.path and ?Control, and probably ?sprintf.

Though, there is the raster package which will read (on demand) all
the rasters into a single object from many files, as long as they
share the same spatial extent and resolution. See this, not to be
confused with R's ?stack:

 library(raster); help(stack)

R-Sig-Geo is a mailing list dedicated to questions like these.

Cheers, Mike.



On Thu, May 16, 2013 at 8:31 PM, Eddie Smith <eddieatr at gmail.com> wrote:
> Thanks Pascal. Got it!
>
> Is there any option that I could read many images in one go? 200 images in
> a folder for example?
>
>
> On Thu, May 16, 2013 at 11:22 AM, Pascal Oettli <kridox at ymail.com> wrote:
>
>> Hi,
>>
>> I am able to read it by changing the name inside your example...
>> ('daily_sea_surface_**temperature_1982003_night.img'**)
>>
>> > summary(SST1982003)
>> Object of class SpatialGridDataFrame
>> Coordinates:
>>     min   max
>> x  96.5 165.5
>> y -16.5  26.5
>> Is projected: FALSE
>> proj4string :
>> [+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]
>> Grid attributes:
>>   cellcentre.offset   cellsize cells.dim
>> x          96.52083 0.04166667      1656
>> y         -16.47917 0.04166667      1032
>> Data attributes:
>>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
>>    15.0    27.0    28.3    27.8    29.0    32.9 1534778
>>
>> Please provide results of sessionInfo().
>>
>> Regards,
>> Pascal
>>
>>
>>
>> On 05/16/2013 07:02 PM, Eddie Smith wrote:
>>
>>> Hi guys,
>>>
>>> Anybody willing to help?
>>>
>>>  SST1982003 <- readGDAL("daily_sst_1982003_**nighttime.img")
>>>>
>>>
>>> Error in SST1982003 <- readGDAL("daily_sst_1982003_**nighttime.img") :
>>>    invalid (do_set) left-hand side to assignment
>>>
>>> The data can be downloaded from googledrive
>>> https://docs.google.com/file/**d/**0BzzExM8ZYZwxbEh5bGJ0amdkTVE/**
>>> edit?usp=sharing<https://docs.google.com/file/d/0BzzExM8ZYZwxbEh5bGJ0amdkTVE/edit?usp=sharing>
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> ______________________________**________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>
>         [[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.



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list