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

Megan Marcotte megotte at gmail.com
Wed May 2 03:17:44 CEST 2012


Thank you Ashton and Bastien!  That is very helpful.  Both alternatives
suggested to me here worked. Apparently my issue also might have been if I
copied the files while ArcMap was open so now the raster command is working
as well on the .img file (yet another kind person helped me with that).

The files are in now and THANKS so much for your help!  Wonderful to have
that done!
Megan

On Tue, May 1, 2012 at 5:09 AM, Bastien.Ferland-Raymond [via R-sig-geo] <
ml-node+s2731867n7516680h79 at n2.nabble.com> wrote:

>
> 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: [hidden email] <http://user/SendEmail.jtp?type=node&node=7516680&i=0>
> Subject: [
> Message-ID: <[hidden email]<http://user/SendEmail.jtp?type=node&node=7516680&i=1>>
>
> 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.
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=7516680&i=2>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r-sig-geo.2731867.n2.nabble.com/trouble-importing-a-img-file-from-ArcMap-10-tp7515387p7516680.html
>  To unsubscribe from trouble importing a .img file from ArcMap 10, click
> here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7515387&code=bWVnb3R0ZUBnbWFpbC5jb218NzUxNTM4N3wtMTM5Mzg0ODYwMg==>
> .
> NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


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



More information about the R-sig-Geo mailing list