Package com.massifmaps.datasources
Class MBTilesTileDataSource
java.lang.Object
com.massifmaps.datasources.TileDataSource
com.massifmaps.datasources.MBTilesTileDataSource
A tile data source that loads tiles from a local Sqlite database.
The database must contain table "tiles" with the following fields:
"zoom_level" (tile zoom level), "tile_column" (tile x coordinate),
"tile_row" (tile y coordinate), "tile_data" (compressed tile image).
The database must contain table "tiles" with the following fields:
"zoom_level" (tile zoom level), "tile_column" (tile x coordinate),
"tile_row" (tile y coordinate), "tile_data" (compressed tile image).
-
Constructor Summary
ConstructorsConstructorDescriptionMBTilesTileDataSource(int minZoom, int maxZoom, String path) Constructs a MBTilesTileDataSource object.MBTilesTileDataSource(int minZoom, int maxZoom, String path, int scheme) Constructs a MBTilesTileDataSource object with specified tile scheme.MBTilesTileDataSource(String path) Constructs a MBTilesTileDataSource object. -
Method Summary
Modifier and TypeMethodDescriptionGet data source metadata information.
Possible parameters can be found in MBTiles specification.Reads one entry of the source's own metadata, when it has any - the MBTiles or PMTiles
metadata table, for instance.Returns the extent of the tiles in this data source.
The bounds are in coordinate system of the projection of the data source.intReturns the maximum zoom level supported by this data source.intReturns the minimum zoom level supported by this data source.Loads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.Methods inherited from class com.massifmaps.datasources.TileDataSource
buildTagValues, containsMetaDataKey, getMaxOverzoomLevel, getMaxZoomWithOverzoom, getMetaData, getMetaDataElement, getProjection, isMaxOverzoomLevelSet, notifyTilesChanged, setMaxOverzoomLevel, setMetaData, setMetaDataElement
-
Constructor Details
-
MBTilesTileDataSource
Constructs a MBTilesTileDataSource object. TMS tile scheme is used,
Min and max zoom levels are automatically detected.- Parameters:
path- The path to the local Sqlite database file.- Throws:
Exception- If the the file could not be opened.IOException
-
MBTilesTileDataSource
Constructs a MBTilesTileDataSource object. TMS tile scheme is used.- Parameters:
minZoom- The minimum zoom level supported by this data source.maxZoom- The maximum zoom level supported by this data source.path- The path to the local Sqlite database file.- Throws:
Exception- If the the file could not be opened.IOException
-
MBTilesTileDataSource
Constructs a MBTilesTileDataSource object with specified tile scheme.- Parameters:
minZoom- The minimum zoom level supported by this data source.maxZoom- The maximum zoom level supported by this data source.path- The path to the local Sqlite database file.scheme- Tile scheme to use.- Throws:
Exception- If the the file could not be opened.IOException
-
-
Method Details
-
getContainerMetaData
Get data source metadata information.
Possible parameters can be found in MBTiles specification.- Returns:
- Map containing meta data information (parameter names mapped to parameter values).
-
getContainerMetaData
Description copied from class:TileDataSourceReads one entry of the source's own metadata, when it has any - the MBTiles or PMTiles
metadata table, for instance. Sources that carry none return an empty string, as do keys
they do not define. Unlike the meta data map above this is read-only and is NOT attached
to the loaded tiles: a container's metadata can be tens of kilobytes.- Overrides:
getContainerMetaDatain classTileDataSource- Parameters:
key- The metadata key, as named by the container's specification.- Returns:
- The value, or empty string if the source does not provide it.
-
getMinZoom
public int getMinZoom()Description copied from class:TileDataSourceReturns the minimum zoom level supported by this data source.- Overrides:
getMinZoomin classTileDataSource- Returns:
- The minimum zoom level supported (inclusive).
-
getMaxZoom
public int getMaxZoom()Description copied from class:TileDataSourceReturns the maximum zoom level supported by this data source.- Overrides:
getMaxZoomin classTileDataSource- Returns:
- The maximum zoom level supported (exclusive).
-
getDataExtent
Description copied from class:TileDataSourceReturns the extent of the tiles in this data source.
The bounds are in coordinate system of the projection of the data source.- Overrides:
getDataExtentin classTileDataSource- Returns:
- The extent of the data source.
-
getTileMask
-
loadTile
Description copied from class:TileDataSourceLoads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.- Overrides:
loadTilein classTileDataSource- Parameters:
mapTile- The tile to load.- Returns:
- The tile data. If the tile is not available, null may be returned.
-