reading an ESRI grid into R

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

reading an ESRI grid into R

R-sig-geo mailing list
Hi I'm using the raster package to load a DEM from here:
http://www.cec.org/tools-and-resources/map-files/elevation-2007

The data appear to be stored as an ESRI grid (adf) and I have no experience with this format.
From what I can tell this format is similar to a shp file with different files storing different things pertaining to the grid.
I'm using the raster command (raster package) to read the w001001.adf file:

dem<-raster("./Elevation_GRID/NA_Elevation/data/NA_Elevation/na_elevation/w001001.adf")

The produces what looks like a raster with values. Is that all I need to do or should I be reading these data another way?
Thanks
Julie


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: reading an ESRI grid into R

Michael Sumner-2
What you've done is perfectly fine. The raster() function invokes the GDAL
library to do the read, via the rgdal package. It doesn't read any data at
first, so dem is just a metadata shell that raster works with - if you plot
or crop or extract that triggers the actual data read as needed.

You might also try the stars package, to keep it lazy and not read all the
data at first start with the proxy argument:

dem_stars <-
stars::read_stars("./Elevation_GRID/NA_Elevation/data/NA_Elevation/na_elevation/w001001.adf",
proxy = TRUE)

This also uses GDAL but does it with code internal to the sf package. These
are pretty much analogous, but stars can do more when grids are more
general.

The GDAL details for this format are here
https://gdal.org/drivers/raster/arcinfo_grid_format.html

Cheers, Mike

On Tue, Feb 11, 2020 at 5:44 AM Julie Lee-Yaw via R-sig-Geo <
[hidden email]> wrote:

> Hi I'm using the raster package to load a DEM from here:
> http://www.cec.org/tools-and-resources/map-files/elevation-2007
>
> The data appear to be stored as an ESRI grid (adf) and I have no
> experience with this format.
> From what I can tell this format is similar to a shp file with different
> files storing different things pertaining to the grid.
> I'm using the raster command (raster package) to read the w001001.adf file:
>
>
> dem<-raster("./Elevation_GRID/NA_Elevation/data/NA_Elevation/na_elevation/w001001.adf")
>
> The produces what looks like a raster with values. Is that all I need to
> do or should I be reading these data another way?
> Thanks
> Julie
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>


--
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo