/edl-scripts/adf2tif.py

http://alageospatialportal.googlecode.com/ · Python · 17 lines · 10 code · 2 blank · 5 comment · 4 complexity · 9436a0daec2447b29d3c096da5fd0930 MD5 · raw file

  1. #!/usr/bin/python26
  2. import os
  3. import shutil
  4. import edlconfig
  5. #dataset = "/mnt/transfer/media/LaCie/datasets/DEM/"
  6. #gdalapps = "/home/angus/gdal-1.7.2/apps"
  7. for root, dirs, files in os.walk(edlconfig.dataset):
  8. for dir in dirs:
  9. # print(dir)
  10. for name in os.listdir(os.path.join(root,dir)):
  11. if "hdr.adf" in name:
  12. layername = dir
  13. print(layername)
  14. # os.system(edlconfig.gdalapps+"/gdal_translate -of GTiff " + os.path.join(root,dir,name) + " " + os.path.join(root,layername) + ".tif")
  15. os.system(edlconfig.gdalapps+"/gdalwarp -s_srs '" + edlconfig.s_srs + "' -t_srs '" + edlconfig.t_srs + "' -srcnodata \"-32768\" -dstnodata \"-32768\" -of GTiff " + os.path.join(root,dir,name) + " " + os.path.join(root,layername) + ".tif")