[R] Reading in .aux (ESRI raster files) into R

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Sep 25 09:51:35 CEST 2010


On Fri, Sep 24, 2010 at 3:21 PM, JoH <jh643 at york.ac.uk> wrote:
>

> Error in
> readAsciiGrid("F:/GIS.LandcoverEuropeForRisk/Sept10kmmaps/Sp10KPointID.aux")
> :
>  object 'cellsize' not found
>
> My original data in Arc GIS is have a cell size an i'mm curious as to how to
> make sure all the details are included.

 Well at this point absolutely none of the file has been included.

> I also tried to use
>
> Spain10km<-getRasterData("F://RMap//sp10kpointid1", ,band=NULL,

 This is a different file to the one you tried above.

>  Spain10km <- system.file("F://RMap//sp10kpointid1", package="rgdal")

 That won't do anything useful.

> #These lines were used to then try to get it to recognise sp10kpointid1 as a
> member og the GDALReadOnly Dataset.
>> x <- new("GDALReadOnlyDataset", Spain10km)
> Error in .local(.Object, ...) : empty file name
>> x <- new("sp10kpointid1", Spain10km)
>
>
> Which is the best way to read this file into R? Why didn't it include my
> classes?

 Assuming it *is* a valid raster file, then readGDAL from the rgdal
package should handle it:

 require(rgdal)
 data = readGDAL(file.choose())

Using file.choose() here makes sure you dont muck up the path because
it will prompt you to browse for the file. readGDAL is an interface to
all the raster data types that rgdal knows about.

 If this fails, then I am wondering if the file is a valid raster
file. ".aux" is an odd file extension - how did you create it exactly?

Barry



More information about the R-help mailing list