[GIS] convert ArcGrid (.adf) to XYZ using gdal_translate

gdal-translateraster-conversion

I am using: ">gdal_translate -of XYZ w010101.adf ASCII.txt" in the command window to try to get a file with coordinates and elevations from a raster I downloaded from The National Map.

This is the error message I get: "w010101.adf not recognized as a supported file format" However, on TNM website, they show an example that uses a .adf file as the input file (link).

I have checked to make sure that the gdal_translate and the .adf file are located in the right place.

I have seen other questions related to getting XYZ files from .tif files, but not from .adf, and I'm not sure what I'm missing.

Best Answer

When you downloaded the data, you had the option of ArcGRID, GridFloat and IMG. Any of those is readable by GDAL. Of those formats, I prefer the IMG as it's a single file. ArcGRID is a really old format that requires a complete directory structure and is quite fragile (you can easily break them using standard file managers without realising).

That said, you have Arc GRID data. When you extracted, you should have something like:

USGS_NED_2_n70w147_ArcGrid
├── grdn70w147_2
│   ├── dblbnd.adf
│   ├── hdr.adf
│   ├── metadata.xml
│   ├── prj.adf
│   ├── sta.adf
│   ├── w001001.adf
│   └── w001001x.adf
├── grdn70w147_2.aux.xml
├── info
│   ├── arc0000.dat
│   ├── arc0000.nit
│   ├── arc0001.dat
│   ├── arc0001.nit
│   └── arc.dir
├── n70w147
│   ├── n70w147.cpg
│   ├── n70w147.dbf
│   ├── n70w147.prj
│   ├── n70w147.shp
│   └── n70w147.shx
├── NED_DataDictionary.url
├── readme.pdf
├── SpatialMetadata.url
├── USGS_NED_2_n70w147_ArcGrid_meta.html
├── USGS_NED_2_n70w147_ArcGrid_meta.txt
├── USGS_NED_2_n70w147_ArcGrid_meta.xml
└── USGS_NED_2_n70w147_ArcGrid_thumb.jpg

You would then run gdal_translate and pass either the directory name, the hdr.adf or the w001001.adf. I just use the directory name, it's shorter...

gdal_translate -of XYZ USGS_NED_2_n70w147_ArcGrid/grdn70w147_2 grdn70w147_2.xyz.txt
gdal_translate -of XYZ USGS_NED_2_n70w147_ArcGrid/grdn70w147_2/hdr.adf grdn70w147_2.xyz.txt
gdal_translate -of XYZ USGS_NED_2_n70w147_ArcGrid/grdn70w147_2/w001001.adf grdn70w147_2.xyz.txt
Related Question