2

I tried using GDAL Translate as follows and encountered an error.

OutTileName_tif = CH_14.tif
OutTileName_asc = CH_14.asc

gdal.Translate(OutTileName_tif, OutTileName_asc)

Error message is

ValueError: Received a NULL pointer.
3
  • How are you running GDAL translate? I'm not familiar with that syntax. Are you using Mac or Linux? I use command line and would phase it like GDAL_Translate -of AAIGRID Output/CH_14/model/gis/grids/CH_14.tif Output/CH_14/model/gis/grids/CH_14.asc Nov 29, 2018 at 6:40
  • I am using Spyder Python for coding in Windows. I missed specifying format = AAIGrid and reversed the order of inputting the filepaths. Thank you. Nov 29, 2018 at 6:50
  • Ah, Spider isn't a package I'm familiar with but it looks like you have an answer anyway. I've added the Spyder tag to your question. Nov 29, 2018 at 6:54

1 Answer 1

4

Please try with the following Python snippet. Need to remember that outputfile path is first, and is followed by the inputfile path.

gdal.Translate(OutTileName_asc, OutTileName_tif,format='AAIGrid')

Your Answer

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

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