|
QGIS API Documentation 4.3.0-Master (0d5b841b09e)
|
Utility class for reading and writing MBTiles files (which are SQLite3 databases). More...
#include <qgsmbtiles.h>
Classes | |
| struct | TileData |
| Struct representing a raw image tile. More... | |
Public Member Functions | |
| QgsMbTiles (const QString &filename) | |
| Constructs MBTiles reader (but it does not open the file yet). | |
| bool | create (bool deferIndexCreation=false) |
| Creates a new MBTiles file and initializes it with metadata and tiles tables. | |
| QgsRectangle | extent () const |
| Returns bounding box from metadata, given in WGS 84 (if available). | |
| bool | finalize () |
| Finalizes the database after writing all tiles. | |
| bool | isOpen () const |
| Returns whether the MBTiles file is currently opened. | |
| QString | metadataValue (const QString &key) const |
| Requests metadata value for the given key. | |
| bool | open () |
| Tries to open the file, returns true on success. | |
| void | setMetadataValue (const QString &key, const QString &value) const |
| Sets metadata value for the given key. | |
| void | setTileData (const QList< TileData > &tiles) const |
| Adds a batch of tile data within a single SQLite transaction. | |
| void | setTileData (int z, int x, int y, const QByteArray &data) const |
| Adds tile data for the given tile coordinates. | |
| QByteArray | tileData (int z, int x, int y) const |
| Returns raw tile data for given tile. | |
| QImage | tileDataAsImage (int z, int x, int y) const |
| Returns tile decoded as a raster image (if stored in a known format like JPG or PNG). | |
Utility class for reading and writing MBTiles files (which are SQLite3 databases).
See the specification for more details: https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md
Definition at line 38 of file qgsmbtiles.h.
|
explicit |
Constructs MBTiles reader (but it does not open the file yet).
Definition at line 27 of file qgsmbtiles.cpp.
| bool QgsMbTiles::create | ( | bool | deferIndexCreation = false | ) |
Creates a new MBTiles file and initializes it with metadata and tiles tables.
It is up to the caller to set appropriate metadata entries and add tiles afterwards.
| deferIndexCreation | can be set to true to defer creation of the tile_index. This results in much faster tile writes, as the index will not be updated after every tile write. If set to true, a call to finalize() must be made before closing the database. (Since QGIS 4.4) |
true on success. If the file exists already, returns false. Definition at line 68 of file qgsmbtiles.cpp.
| QgsRectangle QgsMbTiles::extent | ( | ) | const |
Returns bounding box from metadata, given in WGS 84 (if available).
Definition at line 163 of file qgsmbtiles.cpp.
| bool QgsMbTiles::finalize | ( | ) |
Finalizes the database after writing all tiles.
This must be called if the database was created using a deferred index.
Definition at line 54 of file qgsmbtiles.cpp.
| bool QgsMbTiles::isOpen | ( | ) | const |
Returns whether the MBTiles file is currently opened.
Definition at line 49 of file qgsmbtiles.cpp.
| QString QgsMbTiles::metadataValue | ( | const QString & | key | ) | const |
Requests metadata value for the given key.
Definition at line 113 of file qgsmbtiles.cpp.
| bool QgsMbTiles::open | ( | ) |
Tries to open the file, returns true on success.
Definition at line 31 of file qgsmbtiles.cpp.
| void QgsMbTiles::setMetadataValue | ( | const QString & | key, |
| const QString & | value ) const |
Sets metadata value for the given key.
Does not overwrite existing entries.
Definition at line 139 of file qgsmbtiles.cpp.
| void QgsMbTiles::setTileData | ( | const QList< TileData > & | tiles | ) | const |
Adds a batch of tile data within a single SQLite transaction.
Definition at line 240 of file qgsmbtiles.cpp.
| void QgsMbTiles::setTileData | ( | int | z, |
| int | x, | ||
| int | y, | ||
| const QByteArray & | data ) const |
Adds tile data for the given tile coordinates.
Does not overwrite existing entries.
Definition at line 214 of file qgsmbtiles.cpp.
| QByteArray QgsMbTiles::tileData | ( | int | z, |
| int | x, | ||
| int | y ) const |
Returns raw tile data for given tile.
Definition at line 175 of file qgsmbtiles.cpp.
| QImage QgsMbTiles::tileDataAsImage | ( | int | z, |
| int | x, | ||
| int | y ) const |
Returns tile decoded as a raster image (if stored in a known format like JPG or PNG).
Definition at line 202 of file qgsmbtiles.cpp.