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
Answer
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.
No comments:
Post a Comment