Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I used to convert tif files to ascii in Qgis 1.8 using gdal translate without having any problems with the output i.e. I have the normal heading and values. When I upgraded to 2.0 I started to get the output below (second image) which do not have the normal headings and values. The ascii grid output looks okay when loaded in Qgis but it seems broken when you check it on Textedit/Notepad/Terminal. I tried to convert the tif file using a newly installed Qgis 2.0 on windows, mac and ubuntu but they have the same results. Any ideas how to fix it?

I used the data from worldclim http://www.worldclim.org/ as sample.

Ascii output from Qgis 1.8

Ascii output from Qgis 2.0

share|improve this question

1 Answer 1

Your bio1_test.asc file is in GeoTiff format (despite the .asc). I had the same problem using the Raster -> translate (Convert Format) form. If you look in the command box at the bottom of the form you will see something like:

gdal_translate -of GTiff 
C:/***/bio1_test.tiff bio1_test.asc

change this to:

gdal_translate -of AAIGrid 
C:/***/bio1_test.tiff bio1_test.asc

(click on the pencil button at right to edit the command) This worked but gave me the following message:

Warning 1: Producing a Golden Surfer style file with DX and DY instead of CELLSIZE since the input pixels are non-square. Use the FORCE_CELLSIZE=TRUE creation option to force use of DX for even though this will be distorted. Most ASCII Grid readers (ArcGIS included) do not support the DX and DY parameters.

I am not sure why the input pixels were not square, perhaps because the data were not projected (I also specified a long, lat extent for the output). My pixel sizes were minimally different:

dx = 0.008334561355
dy = 0.008335388377

I changed the command to:

gdal_translate -co force_cellsize=true -of AAIGrid
path/input_filename.ext output_filename.asc

which gave me an ESRI ASCII grid file that I could use in MaxEnt. There was no noticeable distortion or difference between these grids in a QGIS project.

share|improve this answer
    
Should be fixed in QGIS Master: osgeo-org.1560.x6.nabble.com/…. You need to choose the AAIGrid file format when entering the output filename. If necessary click on the pencil and the -of should change to AAIGRID. –  Andre Joost Jan 16 at 19:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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