I want to cache my raster data(large geotiff files) on local database. I thought to use spatialite. I found librasterlite which provide functionality to do that.

Can anybody point to some tutorial on it. Or is there any other alternative.

Programming environment - C++

I want to store geotiff data to spatialite database. I am using gdal to read metadata and reading tiles converting them to hexwkb format and storing it in raster table (id (integer) and raster (blob) as columns).Table is created but when i am opening my database and select raster data column it shows nothing. I mean i can not explore data and see the tile image. Can any body tell me what should be the format in which we should store the tiled data. Are there any function which can automate these things. Like I tried to integrate rasterlite_load in my code but there were memory leakage in the code. Is there any function in spatialite or rasterlite which can take char buffer of tiled image and store it into blob data type in table (and corresponding function for reading).


2 Answers 2


You could try compiling gdal with spatialite support or storing entire tiffs in a blob column.

See spatialite driver docs:


Then you can use gdal_translate:

gdal_translate -of Rasterlite source.tif RASTERLITE:my_db.sqlite,table=source

There is a rewrite, librasterlite2, available at https://www.gaia-gis.it/fossil/librasterlite2/index , which is "intended to completely replace the superseded librasterlite".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.