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.
Optionaloptions: OpenOptions
Optional settings that configure tile handling.
Releases any resources held by the underlying reader, such as an open file
descriptor when reading from a local file. Readers that hold no resources
(e.g. the HTTP reader or a custom Reader function without a close
method) are unaffected. After calling close, no further methods should
be called on this container.
A promise that resolves once the reader has been closed.
ProtectedgetProtected
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.
ProtectedgetAsynchronously 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.
ProtectedreadProtected
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
VersaTilesclass is a wrapper around a.versatilescontainer file. It provides methods to access tile data, metadata, and other properties within the container.