/edl-scripts/bil2tif.py

http://alageospatialportal.googlecode.com/ · Python · 16 lines · 9 code · 3 blank · 4 comment · 3 complexity · 2fe298af5b46335aab46bd33a15e72a4 MD5 · raw file

  1. #!/usr/bin/python
  2. import os
  3. import shutil
  4. import edlconfig
  5. for root, dirs, files in os.walk(edlconfig.dataset):
  6. for name in files:
  7. if ".BIL" in name:
  8. layername = name.replace(".BIL","")
  9. print(layername)
  10. os.system(edlconfig.gdalapps+"/gdalwarp -s_srs '" + edlconfig.s_srs + "' -t_srs '" + edlconfig.t_srs + "' -srcnodata \"0\" -dstnodata \"-9999\" -of GTiff " + os.path.join(root,name) + " " + os.path.join(root,layername) + ".tif")
  11. # os.system(edlconfig.gdalapps+"/gdal_translate -of GTiff " + os.path.join(root,name) + " " + os.path.join(root,layername) + ".tif")
  12. # os.system(edlconfig.gdalapps+"/gdalwarp -t_srs '" + edlconfig.t_srs + "' " + os.path.join(root,layername) + "GDA.tif " + os.path.join(root,layername) + ".tif")
  13. # os.system("rm " + os.path.join(root,layername) + "GDA.tif")