[gdal-dev] Can I create a GDAL data set from bytes in memory?

Frank Warmerdam warmerdam at pobox.com
Wed Jan 28 11:36:13 EST 2009


Joel Odom wrote:
> I've got a situation where I'm trying to use GDAL to read image files 
> contained within a KMZ archive.  (My project uses both GDAL and libkml.) 
>  Libkml can easily read the image file into memory out of the KMZ 
> archive, but I'd like to pass it to GDAL without having to write it to a 
> temporary file on disk.  I haven't figured out if this can be done yet. 
>  Thanks for any answers.

Joel,

Yes, from C/C++ you can generally utilize the VSI*L facilities to wrap
a memory buffer and have it treated by GDAL as a file.  It does not work
for every image driver, but it works for most common ones.  The documentation
is available with the VSIInstallMemFileHandler() function:

   http://www.gdal.org/cpl__vsi_8h.html#66e2e6f093fd42f8a941b962d4c8a19e

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list