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.
  • 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 – Michael Stimson Nov 29 '18 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. – Ramesh K Banagar Nov 29 '18 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. – Michael Stimson Nov 29 '18 at 6:54
2

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, privacy policy and cookie policy

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