Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::GeoPackage Class Reference

#include <MGeoPackage.h>

Classes

struct  SRSEntry
 
struct  Stats
 
struct  TileLevel
 
struct  TileSet
 

Public Types

enum  OpenMode { GPKG_READONLY = 0x01 , GPKG_READWRITE = 0x02 , GPKG_CREATE = 0x04 }
 
enum  TileDataFormat {
  GPKG_IMG_ANY , GPKG_IMG_JPG , GPKG_IMG_PNG , GPKG_IMG_WEBP ,
  GPKG_ELEV_ANY , GPKG_ELEV_PNG , GPKG_ELEV_TIFF , GPKG_ELEV_TIFF_FLT
}
 

Public Member Functions

virtual bool openDB (const std::string &filename, int flags=GPKG_READONLY)
 
bool closeDB ()
 
int64_t writeTile (TileId tileId, const Maria::GeoBitmap &data, const std::string &tileSetId="")
 
int64_t writeTile (int z, int x, int y, const Maria::GeoBitmap &data, const std::string &tileSetId="")
 
bool readTileAncillary (int64_t tileId, double &scale, double &offset, double &min, double &max, double &mean, double &std_dev, const std::string &tileSetId="") const
 
bool readTileAncillary (int z, int x, int y, double &scale, double &offset, double &min, double &max, double &mean, double &std_dev, const std::string &tileSetId="") const
 
int64_t readTile (int z, int x, int y, Maria::GeoBitmap &data, const std::string &tileSetId="") const
 
int64_t readTile (TileId tileId, Maria::GeoBitmap &data, const std::string &tileSetId="") const
 
int64_t getTileTableId (TileId tileId, const std::string &tileSetId="") const
 
int64_t getTileTableId (int z, int x, int y, const std::string &tileSetId="") const
 
bool deleteTile (TileId tileId)
 
const Statsstats () const
 
bool tileExists (TileId tileId, const std::string &tileSet="") const
 
bool tileExists (int z, int x, int y, const std::string &tileSet="") const
 
void dumpStats ()
 
void setMaxTransactions (int maxTransactions)
 
int maxTransactions () const
 
std::shared_ptr< IProjectorgetSRSProjection (int srsId)
 
const std::map< int, SRSEntry > & getSRS () const
 
const std::map< std::string, std::shared_ptr< TileSet > > & getTileSets () const
 
bool initTileSet (const TileCacheSpec &tcs, int minlevel, int maxlevel, std::string tileSetId="", GeoPackage::TileDataFormat tileFormat=GPKG_IMG_ANY)
 
bool initElevationTileSet (const TileCacheSpec &tcs, int minlevel, int maxlevel, double scale, double offset, double precision, double data_null, std::string tileSetId="", GeoPackage::TileDataFormat tileFormat=GPKG_ELEV_ANY)
 
bool getTileSize (int &width, int &height, const std::string &tileSetId="")
 
std::shared_ptr< IProjectorgetProjector (const std::string &tileSetId="")
 
bool getBoundingBox (double &xMin, double &yMin, double &xMax, double &yMax, const std::string &tileSetId="")
 
bool getTileBoundingBox (double &xMin, double &yMin, double &xMax, double &yMax, const std::string &tileSetId="")
 
bool setBoundingBox (double xMin, double yMin, double xMax, double yMax, const std::string &tileSetId="")
 
bool updateTileBoundingBox (double &xMin, double &yMin, double &xMax, double &yMax, const std::string &tileSetId="")
 
bool getMaxResolution (double &pixelSizeX, double &pixelSizeY, const std::string &tileSetId="")
 
std::shared_ptr< TileSetgetTileSet (const std::string &tileSetId="") const
 
bool getTileCacheSpec (Maria::TileCacheSpec &tcs, const std::string tileSetId="")
 
bool hasExtension (const std::string &extName)
 
bool getTiffCompression () const
 
void setTiffCompression (bool useTiffCompression)
 
void setJPEGQuality (int jpegQuality)
 
bool hasPerTileScaleOffset () const
 

Protected Member Functions

virtual bool initDB ()
 
bool readSRS ()
 
bool readContents ()
 
bool readTileSets ()
 
bool readTileMatrix ()
 
bool readElevationTileSets ()
 
int getCreateSRS (const std::shared_ptr< Maria::IProjector > &pj)
 
int getMaxSRSId ()
 
std::shared_ptr< GeoPackage::TileSetinitTileSet (const std::shared_ptr< TileSet > &ts)
 
bool updateContents (const std::shared_ptr< TileSet > &ts)
 
bool updateTileSet (const std::shared_ptr< TileSet > &tileSet)
 
std::shared_ptr< TileLevelgetTileLevel (const std::shared_ptr< TileSet > &ts, int lvl)
 
std::shared_ptr< TileLevelcreateTileLevel (const std::shared_ptr< TileSet > &ts, int lvl)
 
bool updateTileLevel (const std::shared_ptr< TileSet > &ts, const std::shared_ptr< TileLevel > &tl)
 
bool setTileCacheSpec (const std::shared_ptr< TileSet > &ts, const Maria::TileCacheSpec &tcs, int minlevel, int maxlevel)
 
bool insertExtension (const std::string &table, const std::string &column, const std::string &extension, const std::string &definition, const std::string &scope)
 
bool calcTileStats (const std::shared_ptr< TileSet > &ts, const Maria::GeoBitmap &data, double &min, double &max, double &mean, double &std_dev)
 
bool calcTileBounds (const std::shared_ptr< TileSet > &ts)
 
long long writeTileData (int z, int x, int y, const std::vector< unsigned char > &data, const std::shared_ptr< TileSet > &ts)
 
bool writeTileAncillary (const std::string &tileSetId, int id, double scale, double offset, double min, double max, double mean, double std_dev)
 
int64_t readTileData (int z, int x, int y, std::vector< unsigned char > &data, const std::shared_ptr< TileSet > &ts) const
 
bool isCompatibleTileFormat (TileDataFormat fmt1, TileDataFormat fmt2)
 
void calcCombinedScaleOffset (int64_t tileId, double &scale, double &offset, const std::string &tileSetId) const
 

Protected Attributes

sqlite3 * _db { nullptr }
 
std::map< int, SRSEntry_srs
 
std::map< std::string, std::shared_ptr< TileSet > > _tileSet
 
bool _readOnly { false }
 
bool _tiffCompression { true }
 
int _jpegQuality { 90 }
 
int _numTransactions { 0 }
 
int _maxTransactions { 0 }
 
bool _perTileScaleOffset { false }
 
Stats _stats
 

Detailed Description

GeoPackage - Short description. Detailed description.

Member Function Documentation

◆ getTileCacheSpec()

bool Maria::GeoPackage::getTileCacheSpec ( Maria::TileCacheSpec tcs,
const std::string  tileSetId = "" 
)
inline

Get tile cache spec. This method returns the Maria tile cache spec for the given tile set. If no tile set ID is given, the first tile set is assumed.

◆ getTileSet()

std::shared_ptr< TileSet > Maria::GeoPackage::getTileSet ( const std::string &  tileSetId = "") const
inline

Get tile set. Get tile set by tile set ID. If no ID is given, return the first tile set.

◆ getTileTableId() [1/2]

int64_t Maria::GeoPackage::getTileTableId ( int  z,
int  x,
int  y,
const std::string &  tileSetId = "" 
) const

Get the internal tile table ID from TMS tile Id.

◆ getTileTableId() [2/2]

int64_t Maria::GeoPackage::getTileTableId ( TileId  tileId,
const std::string &  tileSetId = "" 
) const
inline

Get the internal tile table ID from TMS tile Id.

◆ hasExtension()

bool GeoPackage::hasExtension ( const std::string &  extName)

Check if the geopackage uses the given extension.

◆ hasPerTileScaleOffset()

bool Maria::GeoPackage::hasPerTileScaleOffset ( ) const
inline

Check if dataset has per-tile scale and offset values. This is not the case on older elevation data sets.

◆ initElevationTileSet()

bool GeoPackage::initElevationTileSet ( const TileCacheSpec tcs,
int  minlevel,
int  maxlevel,
double  scale,
double  offset,
double  precision,
double  data_null,
std::string  tileSetId = "",
GeoPackage::TileDataFormat  tileFormat = GPKG_ELEV_ANY 
)

Initialize an elevation tile set. This method will create the necessary table entries and set up an elevation data tile set, according to the gpkg_elevation_tiles and optionally the gpkg_elevation_tiles_tiff extensions.

This method must be called before you can add any tile data.

◆ initTileSet()

bool Maria::GeoPackage::initTileSet ( const TileCacheSpec tcs,
int  minlevel,
int  maxlevel,
std::string  tileSetId = "",
GeoPackage::TileDataFormat  tileFormat = GPKG_IMG_ANY 
)

Initialize a tile set. This method will create the necessary table entries and set up an image tile data set with the given parameters.

This method must be called before you can add any tile data.

◆ readTile() [1/2]

int64_t Maria::GeoPackage::readTile ( int  z,
int  x,
int  y,
Maria::GeoBitmap data,
const std::string &  tileSetId = "" 
) const

Get tile data for the given tile index Returns the internal tile table ID which can be used to query for ancillary data, or -1 if no data could be found. Geopackage uses the WMTS/Google scheme, i.e y index increases downwards.

◆ readTile() [2/2]

int64_t Maria::GeoPackage::readTile ( TileId  tileId,
Maria::GeoBitmap data,
const std::string &  tileSetId = "" 
) const
inline

Get tile data for the given tile index Returns the internal tile table ID which can be used to query for ancillary data, or -1 if no data could be found. Geopackage uses the WMTS/Google scheme, i.e y index increases downwards.

◆ readTileAncillary() [1/2]

bool Maria::GeoPackage::readTileAncillary ( int  z,
int  x,
int  y,
double &  scale,
double &  offset,
double &  min,
double &  max,
double &  mean,
double &  std_dev,
const std::string &  tileSetId = "" 
) const
inline

Read ancillary data for elevation data sets. The given tileId is the TMS tile Id. For maximum performance you should use the internal table tile id version instead.

◆ readTileAncillary() [2/2]

bool Maria::GeoPackage::readTileAncillary ( int64_t  tileId,
double &  scale,
double &  offset,
double &  min,
double &  max,
double &  mean,
double &  std_dev,
const std::string &  tileSetId = "" 
) const

Read ancillary data for elevation data sets. The given tileId is the internal table tile ID returned from readTile or getTileId().

◆ setBoundingBox()

bool Maria::GeoPackage::setBoundingBox ( double  xMin,
double  yMin,
double  xMax,
double  yMax,
const std::string &  tileSetId = "" 
)
inline

Set the data bounds for the given tile set. This method will set the bounds for the given tile set and update the content table.

◆ updateTileBoundingBox()

bool Maria::GeoPackage::updateTileBoundingBox ( double &  xMin,
double &  yMin,
double &  xMax,
double &  yMax,
const std::string &  tileSetId = "" 
)
inline

Update the bounds for the given tile set. This method will calculate the bounds of the existing tiles in the tile set and update the tile matrix tables.

◆ writeTile() [1/2]

int64_t GeoPackage::writeTile ( int  z,
int  x,
int  y,
const Maria::GeoBitmap data,
const std::string &  tileSetId = "" 
)

Write tile data for the given tile index (in TMS scheme) Returns the internal table tile ID of the written tile, if successful. If the tile data was empty, no tile is written, and 0 is returned. If an error occurs, -1 is returned.

◆ writeTile() [2/2]

int64_t Maria::GeoPackage::writeTile ( TileId  tileId,
const Maria::GeoBitmap data,
const std::string &  tileSetId = "" 
)
inline

Write tile data for the given tile index (in TMS scheme) Returns the internal table tile ID of the written tile, if successful. If the tile data was empty, no tile is written, and 0 is returned. If an error occurs, -1 is returned.


The documentation for this class was generated from the following files: