[gdal-dev] HDF4 file in byte array results in "not recognised" error

Sam Ritchie sritchie09 at gmail.com
Mon Jan 24 15:32:51 EST 2011


Hey all,

I'm working on an app that needs to pass HDF4 files (MODIS tiles) around as
byte arrays, and then open them up using gdal#Open, from java. Open works
great when I pass in the filepath, so I know that my gdal setup is solid.

The problem is, when I turn the HDF4 file into a byte array and try to use

gdal.FileFromMemBuffer("/vsimem/test.hdf", bytearray);
DataSet data = gdal.Open("/vsimem/test.hdf");

I get an error that reads: "`/vsimem/test.hdf' not recognised as a supported
file format."

I tried something similar, by converting

<VRTDataset rasterXSize=\"1\" rasterYSize=\"1\">
  <GeoTransform>100,1,0,100,0,-1</GeoTransform>
  <VRTRasterBand dataType=\"Byte\" band=\"1\">
  </VRTRasterBand>
</VRTDataset>

to a byte array and reading it in, and that worked great.

Any ideas on how to deal with this issue? I'll note that open SEES the file
in the /vsimem/ directory, it just doesn't recognize it as a valid file. Is
this an issue with HDF4 files, or with large binary sequences? Any ideas on
how to get around this?

Thanks, all,
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110124/6716bf73/attachment.html


More information about the gdal-dev mailing list