GeoPackageTileRetriever wraps a TileDao and fetches tiles by their tile grid coordinates using Web Mercator (XYZ) or WGS84 addressing. It handles the coordinate transformation between the requested tile scheme and the GeoPackage’s native projection internally.
Constructor
A
TileDao for the tile table to retrieve from.Output tile width in pixels. When omitted the tile table’s native width is used.
Output tile height in pixels. When omitted the tile table’s native height is used.
MIME type for the output image. Defaults to
'image/png'.Web Mercator (XYZ) tiles
getTile()
Fetches the Web Mercator tile at the specified XYZ coordinates and returns it as aGeoPackageTile. Returns null if no data is available for that tile.
Tile column in the Web Mercator grid.
Tile row in the Web Mercator grid.
Zoom level.
Resolves to a
GeoPackageTile or null if the tile does not exist.hasTile()
Returnstrue if a tile exists in the GeoPackage for the specified Web Mercator XYZ coordinates.
Tile column.
Tile row.
Zoom level.
true if tile data exists, false otherwise.WGS84 tiles
getTileWGS84()
Fetches a tile using WGS84 (EPSG:4326) tile addressing.hasTileWGS84()
Returnstrue if a tile exists at the given WGS84 tile coordinates.
Custom bounding box
getTileWithBounds()
Fetches a tile whose geographic extent is defined by a custom bounding box and projection.The geographic extent of the desired tile output.
The projection of the provided bounding box.
Scaling
getScaling()
Returns theTileScaling options currently applied to this retriever.
setScaling()
AppliesTileScaling options, enabling zoom-in or zoom-out tile scaling when an exact tile is not available.
A
TileScaling configuration object from the NGA tile scaling extension.getWebMercatorBoundingBox()
Returns the bounding box of the tile table’sTileMatrixSet reprojected to Web Mercator (EPSG:3857).
GeoPackageTile
GeoPackageTile is the result object returned by getTile() and getTileWithBounds(). It wraps the raw image bytes along with the tile’s pixel dimensions.
getData()
Returns the raw encoded image bytes for this tile.The image bytes in the format specified when constructing
GeoPackageTileRetriever (default: PNG).getGeoPackageImage()
Decodes the raw bytes and returns aPromise<GeoPackageImage> that can be drawn to a canvas.
A decoded image wrapper that can be passed to canvas drawing utilities.
getWidth()
Returns the tile width in pixels.getHeight()
Returns the tile height in pixels.getMimeType()
Returns the MIME type of the encoded image data (e.g.'image/png').