RasterLite2 - Rasters in SQLite DB
Starting with GDAL 2.2, the SQLite driver allows reading and writing SQLite
databases containing RasterLite2 coverages.
Those databases can be produced by the utilities of the
such as rl2tools.
The driver supports reading grayscale, paletted, RGB, multispectral images stored as tiles in the many compressed formats supported by libRasterLite2.
The driver also supports reading overviews/pyramids, spatial reference system and spatial extent.
GDAL/OGR must be compiled with sqlite support and against librasterlite2 and libspatialite.
The driver is implemented a unified SQLite / SpatiaLite / RasterLite2
vector and raster capable driver./p>
A RasterLite2 filename can be specified as the connection string. If the
file contains a single RasterLite2 coverage, this one will be exposed as the
GDAL dataset. If the file contains multiple coverages, each one will be exposed
as a subdataset with the syntax RASTERLITE2:filename:coverage_name. See
basic concepts of RasterLite2.
If a coverage is made of several sections, they will be listed as subdatasets
of the coverage dataset, so as to be accessed individually. By default, they
will be exposed as a unified dataset. The syntax of section-based dataset is
The driver supports creating new databases from scratch, adding new coverages to
an existing database and adding sections to an existing coverage.
- APPEND_SUBDATASET=YES/NO: Whether to add the raster to the existing
file. If set to YES, COVERAGE must be specified. Default is NO (ie overwrite
- COVERAGE=string: Coverage name. If not specified, the basename of
the output file is used.
- SECTION=string: Section name. If not specified, the basename of
the output file is used.
Compression method. Default is NONE. See the
information about supported codecs. Note that some codecs may not be
available depending on how librasterlite2 has been built.
- QUALITY=0 to 100: Image quality for JPEG, WEBP and JPEG2000
compressions. Exact meaning depends on the compression method. For WEBP and
JPEG2000, the value 100 triggers the use of their lossless variants.
Raster pixel type. Determines the photometric interpretation. See the
information about supported pixel types. The driver will
automatically determine an appropriate pixel type given the band characteristics.
- BLOCKXSIZE=int_value. Block width. Defaults to 512.
- BLOCKYSIZE=int_value. Block height. Defaults to 512.
- NBITS=1/2/4. Force bit width. This will be by default gotten from
the NBITS metadata item in the IMAGE_STRUCTURE metadata domain of the source
- PYRAMIDIZE=YES/NO. Whether to build automatically build relevant
pyramids/overviews. Defaults to NO. Pyramids can be built with the BuildOverviews() /
- Reading a RasterLite2 database with a single coverage:
- Listing the subdatasets corresponding to the coverages of a RasterLite2
database with several coverages:
- Reading a subdataset corresponding to a coverage:
- Creating a RasterLite2 dataset from a grayscale image:
gdal_translate -f SQLite byte.tif byte.rl2
- Creating a RasterLite2 dataset from a RGB image, and using JPEG compression:
gdal_translate -f SQLite rgb.tif rgb.rl2 -co COMPRESS=JPEG
- Adding a RasterLite2 coverage to an existing SpatiaLite/RasterLite2 database:
gdal_translate -f SQLite rgb.tif rgb.rl2 -co APPEND_SUBDATASET=YES -co COVERAGE=rgb
- Adding pyramids to a coverage:
gdaladdo rgb.rl2 2 4 8 16