Skip to content

MbTilesVectorTileSource

Namespace: ThinkGeo.Core

A local .mbtiles archive of vector tiles - the vector twin of MbTilesRasterTileSource. The archive is the data; how it draws comes from the style layers that reference it.

public sealed class MbTilesVectorTileSource : IVectorTileSource, IRawVectorTileSource, System.IDisposable

Inheritance object → MbTilesVectorTileSource
Implements IVectorTileSource, IRawVectorTileSource, IDisposable

Properties

SourceId

Gets or sets the id style layers reference this source by (their "source"). Binding a style document to this source sets it to the document's source name.

public string SourceId { get; set; }

Property Value

string

TileMatrixSet

public TileMatrixSet TileMatrixSet { get; }

Property Value

TileMatrixSet

MinDataZoom

public int MinDataZoom { get; }

Property Value

int

MaxDataZoom

public int MaxDataZoom { get; }

Property Value

int

IsOpen

public bool IsOpen { get; }

Property Value

bool

MetadataJson

The archive's metadata table as one JSON object, read once at open: every row as a string value, with the "json" row's own content - the vector_layers the archive declares, with their fields - merged in, so a .mbtiles reads the same way PmTilesVectorTileSource.MetadataJson does.

public string MetadataJson { get; private set; }

Property Value

string

Constructors

MbTilesVectorTileSource(string)

Initializes a source over the specified .mbtiles file.

public MbTilesVectorTileSource(string filePath)

Parameters

filePath string
The path of the archive.

Methods

OpenAsync(CancellationToken)

public Task OpenAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

Dispose()

Closes the source for good and lets go of the file: the pooled SQLite connections to it are closed, so it can be moved or deleted straight away. An open or a read under way finishes first; MbTilesVectorTileSource.OpenAsync(CancellationToken) afterwards does nothing, and a tile read throws ObjectDisposedException. Calling it again does nothing. A source given to a map is the map's to dispose for as long as the map holds it: the map disposes every source it still has when it is itself disposed, and disposes nothing a restyle drops - a source that SetStyleAsync replaced is yours to dispose once the new style is applied.

public void Dispose()

Returns

void

GetFeaturesFromTileAsync(int, long, long, CancellationToken)

public Task<Dictionary<string, Collection<Feature>>> GetFeaturesFromTileAsync(int zoom, long x, long y, CancellationToken cancellationToken)

Parameters

zoom int

x long

y long

cancellationToken CancellationToken

Returns

Task<Dictionary<string, Collection<Feature>>>

GetBoundingBox()

Returns the archive's declared coverage in Web Mercator, from its metadata "bounds" entry, or the whole world when the archive declares none or the source is not open yet. Read once at open, as a .pmtiles header is.

public RectangleShape GetBoundingBox()

Returns

RectangleShape