Opened 15 years ago
Closed 15 years ago
#3022 closed defect (fixed)
bad reading of AAIGRID dataset whose last line doesn't have a linebreak character
Reported by: | onnovl | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.2 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
class file: aaigriddataset.cpp in frmts\aaigrid
Attachments (2)
Change History (6)
by , 15 years ago
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Wow! That's quick, thanks!
I am using gdal version 1.6.1.1
I downloaded it from http://download.osgeo.org/gdal/gdal161.zip
================================================ I have build the libraries using the following commandline arguments call "c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\VCVARS32.BAT" nmake /f makefile.vc MSVC_VER=1500 cd swig nmake /f makefile.vc csharp MSVC_VER=1500 ================================================
I included the nmake.opt file (zipped) as well as the asc file.
If you can point me to a set of binaries that work with this asc file it would be great (I tried all day to fix the c++ file but I have not enough knowledge of c++ to change the source)
Kind regards Onno van Logchem
by , 15 years ago
Attachment: | gdal_problem.zip added |
---|
comment:3 by , 15 years ago
Owner: | changed from | to
---|
when i call gdalinfo -mm test.asc i get the following result
c:\gdal\apps>gdalinfo -mm test.asc Driver: AAIGrid/Arc/Info ASCII Grid Files: test.asc Size is 4, 6 Coordinate System is `' Origin = (0.000000000000000,300.000000000000000) Pixel Size = (50.000000000000000,-50.000000000000000) Corner Coordinates: Upper Left ( 0.000, 300.000) Lower Left ( 0.0000000, 0.0000000) Upper Right ( 200.000, 300.000) Lower Right ( 200.000, 0.000) Center ( 100.000, 150.000) Band 1 Block=4x1 Type=Int32, ColorInterp=Undefined
Computed Min/Max=-999913.000,100.000
NoData Value=-9999
it seems that the call VSIFReadL( achReadBuf, 1, sizeof(achReadBuf), fp ) in Getc of aaigriddataset starts to read at the beginning of the line when it does not find a linebreak
comment:4 by , 15 years ago
Milestone: | → 1.6.2 |
---|---|
Priority: | high → normal |
Resolution: | → fixed |
Status: | new → closed |
Summary: | aaigriddataset.cpp: error reading asc file without l → bad reading of AAIGRID dataset whose last line doesn't have a linebreak character |
As no error message was issued by GDAL and your first comment didn't really describe the error, I missed the issue : the last value of the file isn't read correctly.
The error comes from the fact that the last line doesn't have a linebreak character. I've fixed the code to make it more tolerant in that case, in trunk (r17209) and in branches/1.6 (r17210). However I'm not sure that such file is considered as a valid AAIGRID dataset. Anyway, the workaround is trivial : just add a linebreak at the last line.
What is the error you get ? which GDAL version are you using ? It works just fine for me with GDAL 1.6.1