2

I am trying to write a loop to load .adf files into QGIS and create a contour map from each one. The response to an older question about loading .adf files (here: Loading *.adf files into QGIS?) was very good but I would like to know how to perform the same action using Python.

4
  • 1
    Not sure but as the post you linked uses the Add Vector Layer menu and since OGR supports Arc/Info Binary Coverage type files, perhaps you can try the following: layer = QgsVectorLayer("/path/to/file.adf", "layer_name", "ogr").
    – Joseph
    Sep 15, 2015 at 15:22
  • @Joseph I tried this and got the error 'Layer is not valid' Sep 15, 2015 at 17:27
  • 2
    You need to find out what the layer name is, if it is a vector "coverage". Try PAL, ARC, or CNT rather than "layer_name". gdal.org/drv_avcbin.html (Also, for sanity purposes please confirm that it's not a raster ADF according to the notes on that page).
    – mdsumner
    Sep 15, 2015 at 22:08
  • It is in fact a raster file 'hdr.adf', that was the problem. Thanks Sep 16, 2015 at 17:48

1 Answer 1

1

Turns out that the file was indeed a raster file 'hdr.adf'. The python script iface.addRasterLayer(fileName, rasterName) worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.