QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
#include <qgsmbtiles.h>
Public Member Functions | |
QgsMbTiles (const QString &filename) | |
Constructs MBTiles reader (but it does not open the file yet) More... | |
bool | create () |
Creates a new MBTiles file and initializes it with metadata and tiles tables. More... | |
QgsRectangle | extent () |
Returns bounding box from metadata, given in WGS 84 (if available) More... | |
bool | isOpen () const |
Returns whether the MBTiles file is currently opened. More... | |
QString | metadataValue (const QString &key) |
Requests metadata value for the given key. More... | |
bool | open () |
Tries to open the file, returns true on success. More... | |
void | setMetadataValue (const QString &key, const QString &value) |
Sets metadata value for the given key. More... | |
void | setTileData (int z, int x, int y, const QByteArray &data) |
Adds tile data for the given tile coordinates. More... | |
QByteArray | tileData (int z, int x, int y) |
Returns raw tile data for given tile. More... | |
QImage | tileDataAsImage (int z, int x, int y) |
Returns tile decoded as a raster image (if stored in a known format like JPG or PNG) More... | |
Static Public Member Functions | |
static bool | decodeGzip (const QByteArray &bytesIn, QByteArray &bytesOut) |
Decodes gzip byte stream, returns true on success. Useful for reading vector tiles. More... | |
static bool | encodeGzip (const QByteArray &bytesIn, QByteArray &bytesOut) |
Encodes gzip byte stream, returns true on success. Useful for writing vector tiles. More... | |
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 | ( | ) |
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. Returns true on success. If the file exists already, returns false.
Definition at line 52 of file qgsmbtiles.cpp.
|
static |
Decodes gzip byte stream, returns true on success. Useful for reading vector tiles.
Definition at line 210 of file qgsmbtiles.cpp.
|
static |
Encodes gzip byte stream, returns true on success. Useful for writing vector tiles.
Definition at line 266 of file qgsmbtiles.cpp.
QgsRectangle QgsMbTiles::extent | ( | ) |
Returns bounding box from metadata, given in WGS 84 (if available)
Definition at line 133 of file qgsmbtiles.cpp.
bool QgsMbTiles::isOpen | ( | ) | const |
Returns whether the MBTiles file is currently opened.
Definition at line 47 of file qgsmbtiles.cpp.
QString QgsMbTiles::metadataValue | ( | const QString & | key | ) |
Requests metadata value for the given key.
Definition at line 83 of file qgsmbtiles.cpp.
bool QgsMbTiles::open | ( | ) |
Tries to open the file, returns true on success.
Definition at line 32 of file qgsmbtiles.cpp.
void QgsMbTiles::setMetadataValue | ( | const QString & | key, |
const QString & | value | ||
) |
Sets metadata value for the given key.
Does not overwrite existing entries.
Definition at line 109 of file qgsmbtiles.cpp.
void QgsMbTiles::setTileData | ( | int | z, |
int | x, | ||
int | y, | ||
const QByteArray & | data | ||
) |
Adds tile data for the given tile coordinates.
Does not overwrite existing entries.
Definition at line 184 of file qgsmbtiles.cpp.
QByteArray QgsMbTiles::tileData | ( | int | z, |
int | x, | ||
int | y | ||
) |
Returns raw tile data for given tile.
Definition at line 146 of file qgsmbtiles.cpp.
QImage QgsMbTiles::tileDataAsImage | ( | int | z, |
int | x, | ||
int | y | ||
) |
Returns tile decoded as a raster image (if stored in a known format like JPG or PNG)
Definition at line 172 of file qgsmbtiles.cpp.