5

I have many rasters that im trying to combine in order to produce contours. They are in the .bil format so I understand that i need to translate them using gdal first but none of my attempts have worked.

I have tried to used gdal_translate and gdal_merge with no success.

import os 
import sys
import gdal 
chdir C:\Users\jeswa\Desktop\GAL
SDKShell.bat
chdir C:\Users\jeswa\Desktop\TESTY
dir /s/b *.bil >listbil.txt
gdalbuildvrt -input_file_list listbil.txt testscript.vrt
#error does not like N34025raster but passes 44 and 45
gdal_translate -of GTiff C:\Users\jeswa\Desktop\TESTY\testscript.vrt C:/Users/jeswa/Desktop/TESTY/VIRTUALTIFF.tif
#no such thing as gdal_translate apparently
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 1, 2019 at 23:48
6
  • 1
    What error messages are you getting? What is the value of your %PATH% after SDKShell? I use a very similar process to this and it works well; you could try CD c:\your\path\to\GDAL\bin so you can (hopefully) find translate. Commented Jul 2, 2019 at 0:26
  • i’ve decided to skip the translate and produce contours from my vrt, is this acceptable? Commented Jul 2, 2019 at 1:04
  • It should be but be aware that VRT is a slower raster format than a single image file, if you can translate to GeoTIFF with no compression your contours will run much faster. Commented Jul 2, 2019 at 1:21
  • 2
    Why are you doing Python imports in your shell script? Is that some error of formatting in your question? Commented Jul 2, 2019 at 1:41
  • i’m not really sure how to work through QGIS python, which is a requirement, and i only really have experience with arcpy Commented Jul 2, 2019 at 1:42

1 Answer 1

0

QGIS can read BIL files. And you can merge the individual files using Processing Algorithms via Python without using GDAL directly.

  • Load individual files in QGIS (bulk drag/drop)
  • Open Python Console
  • Call the processing algorithm gdal:merge via processing.run()

A very similar example is at http://www.qgistutorials.com/en/docs/3/processing_algorithms_pyqgis.html

answered Jul 2, 2019 at 7:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.