Skip to content

IVectorTileSource

Namespace: ThinkGeo.Core

Supplies vector-tile features to a renderer that draws them itself.

public interface IVectorTileSource

Remarks:

This is the whole contract a GPU style renderer needs from its data: the tile grid, how deep tiles are published, and the features of one exact tile. It is deliberately not a Layer — a source has no styles and does no drawing, so implementations that only feed a renderer (see FeatureSourceVectorTileSource) carry none of the layer machinery.

VectorTileSource is the standard implementation: it serves the sources a style.json document declares, or a tiles URL template.

Properties

TileMatrixSet

Gets the tile grid the source publishes on: one TileMatrix per zoom level, indexed by zoom.

public abstract TileMatrixSet TileMatrixSet { get; }

Property Value

TileMatrixSet

MinDataZoom

Gets the shallowest zoom level tiles are published at. Display zooms above this draw nothing from the source; there is no underzoom counterpart to overzoom, because covering one shallow tile from a deeper level would mean fetching four of them per level descended.

public abstract int MinDataZoom { get; }

Property Value

int

Remarks:

Zero for a source that publishes the whole pyramid, which is why it can be read without a version check. An overlay tileset that starts at z6 reports 6, and the renderer stops asking for tiles it would only get empty answers to.

MaxDataZoom

Gets the deepest zoom level tiles are published at. Display zooms beyond this reuse tiles from this level (overzoom).

public abstract int MaxDataZoom { get; }

Property Value

int

SourceId

Gets or sets the name style layers read this source by - their "source" - and the first half of every key IVectorTileSource.GetFeaturesFromTileAsync(int, long, long, CancellationToken) returns.

public abstract string SourceId { get; set; }

Property Value

string

Remarks:

MapStyle assigns it when the source is registered: the id given to MapStyle.AddVectorTiles(IVectorTileSource, string, StyleLayerSlot, StyleLayer[]), or the vector source name the style document declares. An implementation keeps the value and keys its features with it, so the layers and the tiles agree; because the tiles carry it, one source holds one name. A source that serves several named sources from one instance - VectorTileSource, serving every source its document declares - keys each under the document's own name, returns null here and ignores the assignment.

IsOpen

Gets a value indicating whether the source has been opened.

public abstract bool IsOpen { get; }

Property Value

bool

Methods

OpenAsync(CancellationToken)

Prepares the source for tile requests. Calling it on an already open source is a no-op. The map opens the sources its style names itself, so an application calls this only to read something - the bounding box, the metadata - before the map does.

Task OpenAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken
A cancellation token.

Returns

Task
A task that represents the asynchronous operation.

GetFeaturesFromTileAsync(int, long, long, CancellationToken)

Returns the features of the tile at the given coordinates, keyed by "sourceId|sourceLayer": the name the style registers this source under (the id given to MapStyle.AddVectorTiles(IVectorTileSource, string, StyleLayerSlot, StyleLayer[]), or the source name the style document declares), a |, then the source-layer name. A key without the source name matches no style layer, and its features are not drawn.

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

Parameters

zoom int
The tile zoom level.

x long
The tile column.

y long
The tile row.

cancellationToken CancellationToken
A cancellation token.

Returns

Task<Dictionary<string, Collection<Feature>>>
A task that represents the asynchronous operation and provides the result.

Remarks:

Exactly this tile. An implementation must not substitute a parent when the requested level is deeper than it publishes: choosing which level to read from is the renderer's, made once against IVectorTileSource.MaxDataZoom for the whole scene, and a source that also decided it would fight that. Answer empty for a tile with nothing in it - that is data, not an error.