Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4565 closed defect (fixed)

GDALOpen failed on GRC grid

Reported by: mladen Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.9.0
Severity: major Keywords: gdalopen, grc, vertical mapper, northwood, gdal_translate
Cc: Kyle Shannon

Description (last modified by mladen)

There is an error when trying to open a GRC grid (Northwood VerticalMapper? Classified Grid) with gdal_translate. The command and error is:

C:\>gdal_translate -of vrt "C:\temp\ClassficationGrid-UK-Technologies_1.grc" "C:\temp\ClassficationGrid-UK-Technologies_1.vrt"
 ERROR 4: `C:\temp\ClassficationGrid-UK-Technologies_1.grc' not recognised as a supported file format.
 
GDALOpen failed - 4

This seems like it could be a problem with the file, but I can open it in MapInfo?, as well as Global Mapper 13, so I think the file is OK. I put the .grc/.tab file pair in a zip (~5.3 Mb) at http://dl.dropbox.com/u/53500018/GdalOpenFailedGrid.zip if it helps.

I did some more research, and compared a working grid against the one that fails to open. Here is the working grid, which is almost exactly the same as the failing one (~50K difference in file sizes): http://dl.dropbox.com/u/53500018/WorkingGdalOpen.zip Comparing the two in a binary editor, I see differences in bytes 10 and 26 of the header... not sure exactly what that means without the GRC spec. However, as noted above, the failing grid does open correctly in other software (MapInfo? and Global Mapper 13), so I suspect that there may be a bug in the GDAL GRC driver.

Attachments (1)

4565.patch (776 bytes) - added by Kyle Shannon 9 years ago.
Patch for sizeof() issue on windows.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by mladen

Description: modified (diff)

comment:2 Changed 9 years ago by warmerdam

I confirmed the problem this morning. I don't know that I have a current email address for Perry Casson - I'll try to look at this tonight if Even doesn't get to it first.

comment:3 Changed 9 years ago by warmerdam

Component: defaultGDAL_Raster

comment:4 Changed 9 years ago by warmerdam

Resolution: fixed
Status: newclosed

I have established that the seek to the classification table at the end of the file was done wrong due to a width * height * bits_per_pixel calculation that overflowed 32bits. I fixed and added a bit of error checking in trunk (r24118) and 1.9 (r24119).

Changed 9 years ago by Kyle Shannon

Attachment: 4565.patch added

Patch for sizeof() issue on windows.

comment:5 Changed 9 years ago by Kyle Shannon

Resolution: fixed
Status: closedreopened

The fix broke my build on win32 msvc10. I don't think MSVC supports struct::member syntax. I looked around and found this:

http://stackoverflow.com/questions/3864583/sizeof-a-struct-member

and tested on win32 (compilation, I don't have autotest on win32) and it compiled. gdalinfo works on the test dataset on both win and linux. Other option would just be #define the size in the header.

comment:6 Changed 9 years ago by warmerdam

Resolution: fixed
Status: reopenedclosed

Kyle,

Sorry about that. I think I have fixed it in trunk (r24120) and 1.9 (r24121) but I don't have a win32 builder handy at work to test. Let me know if the problem persists.

comment:7 Changed 9 years ago by warmerdam

Cc: Kyle Shannon added

+kyle, let me know if the build problem persists after the last change.

comment:8 Changed 9 years ago by Kyle Shannon

Frank, Built in both trunk and 1.9, gdalinfo on the test data worked for the trunk. Thanks.

kss

comment:9 Changed 9 years ago by mladen

I tested this today on my dataset, it worked for all the files I tried. Thanks, guys.

Note: See TracTickets for help on using tickets.