Selon Hermann Peifer <[email protected]>:

> 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

>
> Thanks for your time, Hermann
>
> ----------
>
> $ gdalinfo --debug on test.asc
> ERROR 4: `test.asc' not recognised as a supported file format.
>
> gdalinfo failed - unable to open 'test.asc'.
>
>
> $ gdalinfo --debug on test2.asc
> GDAL: GDALOpen(test2.asc, this=0xab0610) succeeds as AAIGrid.
> Driver: AAIGrid/Arc/Info ASCII Grid
> Files: test2.asc
> Size is 1, 1
> Coordinate System is `'
> Origin = (0.000000000000000,1.000000000000000)
> Pixel Size = (1.000000000000000,-1.000000000000000)
> Corner Coordinates:
> Upper Left  (   0.0000000,   1.0000000)
> Lower Left  (   0.0000000,   0.0000000)
> Upper Right (   1.0000000,   1.0000000)
> Lower Right (   1.0000000,   0.0000000)
> Center      (   0.5000000,   0.5000000)
> Band 1 Block=1x1 Type=Int32, ColorInterp=Undefined
> GDAL: GDALClose(test2.asc, this=0xab0610)
>
>
> $ gdalinfo --debug on test3.asc
> GDAL: GDALOpen(test3.asc, this=0x16c5610) succeeds as AAIGrid.
> Driver: AAIGrid/Arc/Info ASCII Grid
> Files: test3.asc
> Size is 1, 1
> Coordinate System is `'
> Origin = (0.000000000000000,1.000000000000000)
> Pixel Size = (1.000000000000000,-1.000000000000000)
> Corner Coordinates:
> Upper Left  (   0.0000000,   1.0000000)
> Lower Left  (   0.0000000,   0.0000000)
> Upper Right (   1.0000000,   1.0000000)
> Lower Right (   1.0000000,   0.0000000)
> Center      (   0.5000000,   0.5000000)
> Band 1 Block=1x1 Type=Int32, ColorInterp=Undefined
> GDAL: GDALClose(test3.asc, this=0x16c5610)
>
>
> $ cat test.asc
> ncols         1
> nrows         1
> xllcorner     0
> yllcorner     0
> cellsize      1
> 0
> $ cat test2.asc
> ncols         1
> nrows         1
> xllcorner     0
> yllcorner     0
> cellsize      1
> 0 0 0 0 0 0 0 0 0 0
> $ cat test3.asc
> ncols         1
> nrows         1
> xllcorner     0
> yllcorner     0
> cellsize      1
> 123456789 987654321
> $
>
>
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to