[gdal-dev] Can GDAL Access Raster File Stored as Blob in SQLite3 Database?

Even Rouault even.rouault at spatialys.com
Thu Nov 6 08:41:12 PST 2014

Le jeudi 06 novembre 2014 17:34:02, Jema a écrit :
> Hello all,
> After evaluating the Rasterlite driver and database, I've found it to be
> able to support everything I need except store projections for multiple
> rasters.  I've seen hints of a Rasterlite2 driver in the works, but as of
> yet it's not available.  I would prefer to stick with sqlite3 rather than a
> more complex solution using PostGIS or another server database.  The
> rasters I'm working with are sized a few megabytes and order in the hundred
> of thousands to millions.  In the meantime, I've stored each raster file
> (tiff format) as a blob in a table, which can be efficiently queried and
> accessed.  Now to my question:  is there a way to pass the sqlite3 handle
> to GDAL to read a given band and block from the data?  Also, if there is an
> easier solution, please tell me.


If you get the blob yourself from C# with the sqlite C# API (assuming that 
exists), then you can use gdal.FileFromMemBuffer('/vsimem/bla.tif', the_blob) 
to create a virtual file in memory and gdal.Open('/vsimem/bla.tif'). At least 
that's how to do it in Python. Not sure if the C# bindings have the typemap 
necessary for FileFromMemBuffer() to work.


> I'm using a recent build of GDAL C# bindings on Windows 7.
> Thanks.
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Can-GDAL-Access-Raster-File-Stored-as-
> Blob-in-SQLite3-Database-tp5171697.html Sent from the GDAL - Dev mailing
> list archive at Nabble.com.

Spatialys - Geospatial professional services

More information about the gdal-dev mailing list