[gdal-dev] ERROR 4: `test.asc' not recognised as a supported file format.

Hermann Peifer peifer at gmx.eu
Fri Aug 26 13:28:32 EDT 2011


On 26/08/2011 16:33, Even Rouault wrote:
> Selon Hermann Peifer<peifer at gmx.eu>:
>
>> Hi,
>>
>> Occasionally I use a small .asc file, which I then gdal_translate into a
>> bigger blank GeoTIFF. I tried to make the smallest possible test.asc
>> file with 1 col x 1 row and 1 cell value only, but I ended up with ERROR
>> 4: file not recognised as a supported file format.
>>
>> The error message seems to go away after adding (useless) values to the
>> file, see below.
>>
>> I am wondering if this is a feature or rather a bug?
>
> Feature/bug/hazard... who knows ;-) The test that identifies if a file is
> AAIGRID first checks if there are at least 100 bytes in the file, which looks
> like a rough estimate of the size taken by the minimum header lines and should
> be fine for any sensible raster. I guess this test could be just killed since
> the Identify() also checks the presence of one of the keywords. But you have
> found the workaround, just add enough spaces at the end of your files and it
> should be OK. Anyway you can create a ticket if you wish
>

Even,

Thanks for the explanation. Ticket created at 
http://trac.osgeo.org/gdal/ticket/4209.

For the time being, I just add more spaces into the header lines, like 
this example, which has just about enough bytes to get through the test:

ncols             1
nrows             1
xllcorner         0
yllcorner         0
cellsize          1
0


Hermann


More information about the gdal-dev mailing list