[gdal-dev] extra spaces when writing to AAIGRID format

Eli Adam eadam at co.lincoln.or.us
Thu Dec 15 14:34:34 EST 2011


Brad,

> E.g., if I try to write a 3x3 grid that ArcGIS can read, it needs to look
> something like this:
>
> ncols        3
> nrows        3
> xllcorner    100.000000000000
> yllcorner    100.000000000000
> cellsize     0.000010000000
> 1.00000000000000000 1.4809201955795288 1.4809201955795288
> 0.11773009598255157 0.15476560592651367 0.86710774898529053
> 0.17429724335670471 0.76037305593490601 10.00000000000000
>
> Instead, the ascii file written by GDAL looks like this (which can't be read
> by ArcGIS because of extra leading spaces in the first line of the data):

What is the ArcGIS error?  I tried these files on ArcMap 9.3 and 10.0
and had no issues that I realized.  (to display in a meaningful
manner, I had to change the symbology which required the calculation
of statistics in ArcGIS.  I also changed the cellsize to .1 so I could
more easily examine the pixels and values.)

Below looks like a 3x4 grid that is labeled as 5x5 but even that
worked for me in ArcGIS (didn't throw error but values were not where
'expected').

>
>
> ncols        5
> nrows        5
> xllcorner    100.000000000000
> yllcorner    100.000000000000
> cellsize     0.000010000000
>      1 1.4809201955795288 1.4809201955795288
>  0.25947147607803345 0.71342569589614868 2.8101832866668701
>  0.11773009598255157 0.15476560592651367 0.86710774898529053
>  0.17429724335670471 0.76037305593490601     10 0.74458205699920654
>

All 4 of of Even's files worked for me too.

HTH, Eli


More information about the gdal-dev mailing list