pub struct PMTilesReader {
pub data_reader: Arc<DataReader>,
pub header: HeaderV3,
pub internal_compression: TileCompression,
pub leaves_bytes: Arc<Blob>,
pub leaves_cache: Cache<ByteRange, Arc<EntriesV3>>,
pub tilejson: TileJSON,
pub metadata: TileSourceMetadata,
pub root_bytes_uncompressed: Blob,
pub root_entries: Arc<EntriesV3>,
}Expand description
Re‑exports the container registry and common open/write helpers.
Reader for PMTiles v3 containers.
Parses the header and directory blobs, merges embedded TileJSON, computes a
tile pyramid by traversing directory entries, and exposes tiles via
the TileSource interface.
Fields§
§data_reader: Arc<DataReader>Underlying byte source used to read header, directories, and tile data.
header: HeaderV3Parsed PMTiles v3 header with byte ranges, counts, and compression flags.
internal_compression: TileCompressionCompression algorithm used for internal metadata/directories (e.g., gzip).
leaves_bytes: Arc<Blob>Raw (compressed) concatenated blob of all leaf directories.
leaves_cache: Cache<ByteRange, Arc<EntriesV3>>Decompression cache mapping leaf directory byte ranges to parsed entries. Concurrent loads of the same range dedup automatically; distinct ranges decompress in parallel.
tilejson: TileJSONMerged TileJSON metadata extracted from the PMTiles metadata range.
metadata: TileSourceMetadataRuntime parameters (tile format, compression, tile pyramid) advertised by this reader.
root_bytes_uncompressed: BlobUncompressed root directory blob.
root_entries: Arc<EntriesV3>Parsed entries of the root directory (shared across queries).
Implementations§
Source§impl PMTilesReader
impl PMTilesReader
Sourcepub async fn open(path: &Path, runtime: TilesRuntime) -> Result<PMTilesReader>
pub async fn open(path: &Path, runtime: TilesRuntime) -> Result<PMTilesReader>
Open a PMTiles container from an absolute filesystem path.
Validates and opens a DataReaderFile, then delegates to PMTilesReader::open_data.
§Errors
Returns an error if the file cannot be opened.
Sourcepub async fn open_data(
data_reader: DataReader,
_runtime: TilesRuntime,
) -> Result<PMTilesReader>where
Self: Sized,
pub async fn open_data(
data_reader: DataReader,
_runtime: TilesRuntime,
) -> Result<PMTilesReader>where
Self: Sized,
Open a PMTiles container from an existing DataReader.
Reads the v3 header, decompresses and parses the metadata (TileJSON) and
root directory, prepares leaf directory bytes, computes the tile pyramid, and
initializes caches for fast lookups.
§Errors
Returns an error if reading or decompression fails, or if the header/dirs are invalid.
Sourcepub fn tile_entries(&self) -> Result<EntriesV3>
pub fn tile_entries(&self) -> Result<EntriesV3>
Decode and return the root directory entries (EntriesV3).
Trait Implementations§
Source§impl Debug for PMTilesReader
impl Debug for PMTilesReader
Source§impl TileSource for PMTilesReader
impl TileSource for PMTilesReader
Source§fn metadata(&self) -> &TileSourceMetadata
fn metadata(&self) -> &TileSourceMetadata
Returns the current reader parameters (tile format, compression, tile pyramid).
Source§fn tile<'life0, 'life1, 'async_trait>(
&'life0 self,
coord: &'life1 TileCoord,
) -> Pin<Box<dyn Future<Output = Result<Option<Tile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn tile<'life0, 'life1, 'async_trait>(
&'life0 self,
coord: &'life1 TileCoord,
) -> Pin<Box<dyn Future<Output = Result<Option<Tile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a tile by XYZ coordinate.
Converts the coordinate to a Hilbert tile ID, then traverses up to three levels
of PMTiles directories to locate the tile. Leaf directories are cached to avoid
repeated decompression. Returns Ok(None) if the tile does not exist.
Source§fn source_type(&self) -> Arc<SourceType> ⓘ
fn source_type(&self) -> Arc<SourceType> ⓘ
Source§fn tile_pyramid<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Arc<TilePyramid>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tile_pyramid<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Arc<TilePyramid>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn tile_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, Tile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tile_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, Tile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn tile_size_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tile_size_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn tile_coord_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, ()>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tile_coord_stream<'life0, 'async_trait>(
&'life0 self,
bbox: TileBBox,
) -> Pin<Box<dyn Future<Output = Result<TileStream<'static, ()>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn boxed(self) -> Box<dyn TileSource>where
Self: Sized + 'static,
fn boxed(self) -> Box<dyn TileSource>where
Self: Sized + 'static,
self into a boxed trait object for dynamic dispatch.self into a shared reference for concurrent access. Read moreSource§impl TilesReader for PMTilesReader
impl TilesReader for PMTilesReader
Source§fn open_reader<'async_trait>(
reader: DataReader,
runtime: TilesRuntime,
) -> Pin<Box<dyn Future<Output = Result<SharedTileSource>> + Send + 'async_trait>>
fn open_reader<'async_trait>( reader: DataReader, runtime: TilesRuntime, ) -> Pin<Box<dyn Future<Output = Result<SharedTileSource>> + Send + 'async_trait>>
DataReader source. Read moreSource§fn supports_data_reader() -> bool
fn supports_data_reader() -> bool
true when the reader can open from a generic DataReader source
(e.g. for HTTP). File-only readers (MBTiles, TAR) return false.Auto Trait Implementations§
impl !RefUnwindSafe for PMTilesReader
impl !UnwindSafe for PMTilesReader
impl Freeze for PMTilesReader
impl Send for PMTilesReader
impl Sync for PMTilesReader
impl Unpin for PMTilesReader
impl UnsafeUnpin for PMTilesReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.