[gdal-dev] GDAL, HDF4 and MODIS L1B data
Even Rouault
even.rouault at spatialys.com
Mon Nov 11 04:29:03 PST 2024
Hernan,
this works for me both with HDF4 4.2.14 as available on my system, and
also against 4.3.0 built from source with the exact configure command
line your provided
Can you show the result of "grep HDF4 CMakeCache.txt | grep -v INTERNAL
| grep -v ADVANCED" in your GDAL build directory?
For me, looks like that:
//Set ON to build Hierarchical Data Format Release 4 (HDF4) format
GDAL_ENABLE_DRIVER_HDF4:BOOL=ON
//Set ON to build GDAL HDF4 driver as plugin
GDAL_ENABLE_DRIVER_HDF4_PLUGIN:BOOL=ON
//Set ON to use HDF4
GDAL_USE_HDF4:BOOL=ON
HDF4_INCLUDE_DIR:PATH=/home/even/install-hdf4-4.3.0/include
HDF4_df_LIBRARY_DEBUG:FILEPATH=HDF4_df_LIBRARY_DEBUG-NOTFOUND
HDF4_df_LIBRARY_RELEASE:FILEPATH=/home/even/install-hdf4-4.3.0/lib/libdf.so
HDF4_mfhdf_LIBRARY_DEBUG:FILEPATH=HDF4_mfhdf_LIBRARY_DEBUG-NOTFOUND
HDF4_mfhdf_LIBRARY_RELEASE:FILEPATH=/home/even/install-hdf4-4.3.0/lib/libmfhdf.so
HDF4_szip_LIBRARY_DEBUG:FILEPATH=HDF4_szip_LIBRARY_DEBUG-NOTFOUND
HDF4_szip_LIBRARY_RELEASE:FILEPATH=HDF4_szip_LIBRARY_RELEASE-NOTFOUND
HDF4_xdr_LIBRARY_DEBUG:FILEPATH=HDF4_xdr_LIBRARY_DEBUG-NOTFOUND
HDF4_xdr_LIBRARY_RELEASE:FILEPATH=HDF4_xdr_LIBRARY_RELEASE-NOTFOUND
//Details about finding HDF4
//Old value of option GDAL_ENABLE_DRIVER_HDF4_PLUGIN
//Test HDF4_HAS_MAXOPENFILES
But I strongly suspect you're running a version of GDAL which is not the
one you have built. You may have to adjust your PATH and
LD_LIBRARY_PATH. Check with "which gdalinfo" and then "ldd
/path/to/gdalinfo" that you are running the binaries you've built.
"gdalinfo --formats" return the list of drivers, and "gdalinfo --format
driver_name" return detailed info on the given driver
Even
Le 11/11/2024 à 13:04, Hernán De Angelis via gdal-dev a écrit :
> 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> *Puolesta
>> *Hernán De Angelis via gdal-dev
>> *Lähetetty:* maanantai 11. marraskuuta 2024 13.37
>> *Vastaanottaja:* 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
>>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241111/6f4aeead/attachment-0001.htm>
More information about the gdal-dev
mailing list