Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#4548 closed defect (fixed)

BAG Tiled Images Broken

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.9.2
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: BAG
Cc: schwehr


It seems there are some serious flaws in the tiled handling in the BAG driver.

One problem is that the windowing logic is such that some windows will be off the dataset resulting in HDF5 library errors like:

HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139969020036928:
 #000: ../../../src/H5Dio.c line 153 in H5Dread(): selection+offset not within extent
   major: Dataspace
   minor: Out of range

It also appears that the blocks are not properly "Y flipped" which is required for bag datasets.

I am not sure if my test dataset is public.

Change History (6)

comment:1 by warmerdam, 11 years ago

I have migrated the tile handling logic from the HDF5 driver with a few adjustments for the upsidedownness of BAG data in trunk (r24083).

Kurt - are there any public samples with this issue that aren't so large?

Once a bit better tested, I'd like to back port this to at least the 1.9 branch.

comment:2 by Kurt Schwehr, 11 years ago

I will put out a call for small test files. -kurt

comment:3 by Kurt Schwehr, 11 years ago

What H11553_A_2m.bag about in ? It's just under 1MB. Send a request for other small files to nav_surf_dev@…. Can't seem to find a public archive to link to.

gdalinfo H11553_A_2m.bag 
Driver: BAG/Bathymetry Attributed Grid
Files: H11553_A_2m.bag
Size is 333, 317
Coordinate System is:
PROJCS["UTM Zone 10, Northern Hemisphere",
            SPHEROID["GRS 1980",6378137,298.257222101,
Origin = (535504.540000000037253,5391128.200000000186265)
Pixel Size = (2.000000000000000,-2.000000000000000)
Corner Coordinates:
Upper Left  (  535504.540, 5391128.200) (122d31' 3.87"W, 48d40'19.89"N)
Lower Left  (  535504.540, 5390494.200) (122d31' 4.06"W, 48d39'59.36"N)
Upper Right (  536170.540, 5391128.200) (122d30'31.30"W, 48d40'19.75"N)
Lower Right (  536170.540, 5390494.200) (122d30'31.50"W, 48d39'59.22"N)
Center      (  535837.540, 5390811.200) (122d30'47.68"W, 48d40' 9.56"N)
Band 1 Block=333x1 Type=Float32, ColorInterp=Undefined
  Description = elevation
  Min=-33.810 Max=-29.001 
  NoData Value=1000000
Band 2 Block=333x1 Type=Float32, ColorInterp=Undefined
  Description = uncertainty
  Min=0.206 Max=1.036 
  NoData Value=0

comment:4 by jdvarner, 10 years ago

I just wanted to report that the BAG file reader is working a lot better in the latest GDAL trunk build. I used GDAL to read the archive of BAGs at NOAA/NGDC in order to generate the color hillshade visualizations, which is available as an ArcGIS map service (see So far GDAL is working as expected. Previously, there was a problem reading the newer BAGs that use compression.

Here are a few examples of BAGs that previously failed to convert in GDAL 1.9.1, but are working OK for me now using the trunk build. I used a command like 'gdal_translate -b 1 input.bag output.tif'.


comment:5 by warmerdam, 10 years ago

Resolution: fixed
Status: newclosed

The above samples are not small when unpacked unfortunately, but based on the positive report by jdvarner, I've backported the patch into 1.9 (r24974).

comment:6 by warmerdam, 10 years ago

Note: See TracTickets for help on using tickets.