Constructs a new instance of the VersaTiles class.
The data source for the tiles. This can be a URL starting with http://
or https://
,
a path to a local file, or a custom Reader
function that reads data chunks based on offset and length.
Optional
options: OpenOptionsOptional settings that configure tile handling.
Protected
getProtected
Asynchronously retrieves a mapping of tile block indices. The map's keys are formatted as "{z},{x},{y}". This method is for internal use to manage tile lookup within the container.
A promise that resolves with the block index map.
Asynchronously retrieves the header information from the .versatiles
container.
A promise that resolves with the header object.
Asynchronously retrieves the metadata associated with the .versatiles
container.
Metadata typically includes information about vector_layers
for vector tiles.
If the container does not include metadata, this method returns null
.
A promise that resolves with an object representing the metadata.
Asynchronously retrieves a specific tile's data as a Buffer. If the tile data is compressed as
defined in the container header, the returned Buffer will contain the compressed data.
To obtain uncompressed data, use the getTileUncompressed
method.
If the specified tile does not exist, the method returns null
.
The zoom level of the tile.
The x coordinate of the tile within its zoom level.
The y coordinate of the tile within its zoom level.
A promise that resolves with the tile data as a Buffer, or null if the tile cannot be found.
Protected
getAsynchronously retrieves a specific tile's uncompressed data as a Buffer. This method first
retrieves the compressed tile data using getTile
and then decompresses it based on the
compression setting in the container header.
If the specified tile does not exist, the method returns null
.
The zoom level of the tile.
The x coordinate of the tile within its zoom level.
The y coordinate of the tile within its zoom level.
A promise that resolves with the uncompressed tile data as a Buffer, or null if the tile cannot be found.
Protected
readProtected
A protected method to read a chunk of data from the source based on the specified offset and length.
The offset from the start of the source data to begin reading.
The number of bytes to read from the source.
A promise that resolves with the read data as a Buffer.
The
VersaTiles
class is a wrapper around a.versatiles
container file. It provides methods to access tile data, metadata, and other properties within the container.