[gdal-dev] GDAL, HDF4 and MODIS L1B data

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Mon Nov 11 04:14:58 PST 2024


Hi,

I can't help you with building GDAL but I can show where to learn the difference between --formats and --format: https://gdal.org/en/latest/programs/raster_common_options.html#raster-common-options

-Jukka Rahkonen-

Lähettäjä: Hernán De Angelis <variablestarlight at gmail.com>
Lähetetty: maanantai 11. marraskuuta 2024 14.04
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>; gdal-dev at lists.osgeo.org
Aihe: Re: [gdal-dev] GDAL, HDF4 and MODIS L1B data

Thank you for your response, Jukka.

That is interesting. I set cmake to build hdf4, cmake sees it and it does not throw errors during the build. In fact, I see:

[ 38%] Built target gdal_HDF4

but the command you gave gives not HDF4

gdalinfo --format hdf4

(should be "formats" instead?)
gdalinfo --formats hdf4

this retrieves a long list, but no HDF5:

gdalinfo --formats | grep hdf
  HDF5 -raster,multidimensional raster- (rovs): Hierarchical Data Format Release 5 (*.h5, *.hdf5)

on the other hand
gdal-config --formats

gives:

gdal-config --formats
MEM vrt HDF4 MEM

So it should be there?

This is confusing. Will keep looking.

Thank you for your time, Jukka!

Hernán

Den 2024-11-11 kl. 12:45, skrev Rahkonen Jukka:
Hi,

Have you checked with gdalinfo if you have managed to build the HDF4 driver?
gdalinfo --format hdf4

Your test file opens for me with GDAL from OSGeo4W.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org><mailto:gdal-dev-bounces at lists.osgeo.org> Puolesta Hernán De Angelis via gdal-dev
Lähetetty: maanantai 11. marraskuuta 2024 13.37
Vastaanottaja: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] GDAL, HDF4 and MODIS L1B data

I recently compiled a minimal GDAL (3.10) with HDF4 support (using HDF 4.3.0) for processing MODIS L1B data. However, the resulting command line tools cannot understand the format. Perhaps I am doing something wrong, or missing something important, or both.

Do I understand correctly that MODIS L1B in HDF-EOS format should be readable by GDAL compiled with HDF4 support without additional libraries?

Thanks for any hint.

Hernán



Workflow:

Build HDF4 (4.3.0)

./configure --prefix=/home/hernan/project --disable-netcdf --disable-fortran --enable-shared --disable-static
make
make install


Build GDAL (3.10) with HDF4 support
ccmake , make, ... etc

/home/hernan/project/bin/gdal-config --formats
MEM vrt HDF4 MEM



Test

/home/hernan/project/bin/gdalinfo MOD02QKM.A2024307.1325.061.2024308012941.hdf
ERROR 4: `MOD02QKM.A2024307.1325.061.2024308012941.hdf' not recognized as being in a supported file format.
gdalinfo failed - unable to open 'MOD02QKM.A2024307.1325.061.2024308012941.hdf'.



Testdata if someone wants to try (warning: 150 Mb!):
https://www.geonatura.se/lastkaj/index.php/s/TCS35pjANsEtSyV

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241111/5e751ce6/attachment.htm>


More information about the gdal-dev mailing list