Package com.massifmaps.datasources
Class PMTilesTileDataSource
java.lang.Object
com.massifmaps.datasources.TileDataSource
com.massifmaps.datasources.PMTilesTileDataSource
A tile data source that loads tiles from a PMTiles v3 archive file.
PMTiles is a single-file archive format for pyramids of tiled data.
The archive format supports efficient random access and metadata storage.
PMTiles is a single-file archive format for pyramids of tiled data.
The archive format supports efficient random access and metadata storage.
-
Constructor Summary
ConstructorsConstructorDescriptionPMTilesTileDataSource(int minZoom, int maxZoom, String path) Constructs a PMTilesTileDataSource object with specified zoom levels.PMTilesTileDataSource(String path) Constructs a PMTilesTileDataSource object.
Min and max zoom levels are automatically detected from the PMTiles header. -
Method Summary
Modifier and TypeMethodDescriptionGet PMTiles archive metadata information as a JSON string.
The metadata is stored in the PMTiles archive and may contain
information such as name, description, attribution, vector layers, etc.Get a specific metadata value by key from the parsed JSON metadata.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
-
PMTilesTileDataSource
Constructs a PMTilesTileDataSource object.
Min and max zoom levels are automatically detected from the PMTiles header.- Parameters:
path- The path to the PMTiles archive file.- Throws:
Exception- If the file could not be opened or is not a valid PMTiles archive.IOException
-
PMTilesTileDataSource
Constructs a PMTilesTileDataSource object with specified zoom levels.- 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 PMTiles archive file.- Throws:
Exception- If the file could not be opened or is not a valid PMTiles archive.IOException
-
-
Method Details
-
getContainerMetaData
Get PMTiles archive metadata information as a JSON string.
The metadata is stored in the PMTiles archive and may contain
information such as name, description, attribution, vector layers, etc.- Returns:
- JSON string containing metadata, or empty string if no metadata exists.
-
getContainerMetaData
Get a specific metadata value by key from the parsed JSON metadata.- Overrides:
getContainerMetaDatain classTileDataSource- Parameters:
key- The metadata key to retrieve (e.g., "name", "description", "attribution").- Returns:
- The metadata value as a string, or empty string if not found.
-
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.
-
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.
-