[R-sig-Geo] RE : trouble importing a .img file from ArcMap 10

Bastien.Ferland-Raymond at mrnf.gouv.qc.ca Bastien.Ferland-Raymond at mrnf.gouv.qc.ca
Tue May 1 14:08:39 CEST 2012


Hello Megan,

Personally, I import my .img files with the package Raster.

Try:

Elev <- stack("file_name.img")

Than you can see the result with:

Str(Elev)

And something like:

Plot(Elev)

See: http://cran.r-project.org/web/packages/raster/raster.pdf

For more details


Bastien Ferland-Raymond, M.Sc. Stat., M.Sc. Biol.

------------------------------

Message: 6
Date: Mon, 30 Apr 2012 16:21:23 -0700 (PDT)
From: Megan Marcotte < >
To: r-sig-geo at r-project.org
Subject: [
Message-ID: <1335828083349-7515387.post at n2.nabble.com>
Content-Type: text/plain; charset=us-ascii

Hello,

This is a rather low level question but I'd appreciate your help. I have
given a colleague .img files from ArcMap 10 to import into R. I don't know R
and she is new to ArcMap files and we are having trouble getting the files
in. I was hoping some of you could set us straight on what we are doing
wrong.

When I look in ArcMap the file works well and contains data. There are 5
source files for the raster in ArcMap but only the .img, .img.vat.dbf, and
.rrd files were attachable by email (so I did not send a disc image file or
a lock file).

My colleague has install RGDAL and GDAL (and other packages) and tried
importing using functions raster and readGDAL to import the .img file, but
gets the following errors:

> Elev <- raster("file_name.img")
Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer",
:
  Cannot create a RasterLayer object from this file.

> Elev <- readGDAL("file_name.img")

Error in .local(.Object, ...) :
  Unable to open file_name.img, it has zero usable bands.

(http://science.nature.nps.gov/im/monitor/stats/R/Data_io.cfm provided
instructions)

We would like to get the file successfully imported and have R know that the
coordinates are in WGS84. Can anyone please advise us on how to accomplish
this?

The file is in .img format  because I converted the coordinate system in
ArcMap. If importing it in its native coordinate system and then converting
to WGS84 in R is easier than I would gratefully accept help on that instead.

Thanks so much!
Megan

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/trouble-importing-a-img-file-from-ArcMap-10-tp7515387.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list