Skip to content

VectorTileOverlay

Namespace: ThinkGeo.UI.WebApi

An overlay whose tiles are vector tiles the browser draws, taken from its VectorTileOverlay.TileSource: a FeatureSourceVectorTileSource cuts an application's feature sources into Mapbox vector tiles as they are asked for; an archive - MbTilesVectorTileSource, PmTilesVectorTileSource - hands them out as it holds them. A Web API action maps a z/x/y route to VectorTileOverlay.GetTileAsync(int, long, long, CancellationToken) and returns the bytes as application/vnd.mapbox-vector-tile with Content-Encoding: gzip; a style document in the browser names the route as its source and draws the tiles. The tiles are web mercator, as the specification has them, whatever projection the data is in.

public class VectorTileOverlay : System.IDisposable

Inheritance object → VectorTileOverlay
Implements IDisposable

Properties

Id

The name the overlay's route goes by, given when it was made.

public string Id { get; }

Property Value

string

TileSource

Where the tiles come from: a FeatureSourceVectorTileSource whose FeatureSourceVectorTileSource.FeatureSources are cut as tiles are asked for, each under the source-layer name a style layer refers to it by; or an archive of ready-made tiles. Past the source's deepest zoom nothing is served; the browser overzooms the deepest tiles itself when the style declares VectorTileOverlay.MaxDataZoom as the source's maxzoom.

public IRawVectorTileSource TileSource { get; }

Property Value

IRawVectorTileSource

MaxDataZoom

The deepest zoom tiles are served for: the archive's, or unbounded when cutting.

public int MaxDataZoom { get; }

Property Value

int

IsOpen

Whether the tile source is open.

public bool IsOpen { get; }

Property Value

bool

Constructors

VectorTileOverlay(IRawVectorTileSource)

Creates an overlay with a generated id that serves a tile source's tiles.

public VectorTileOverlay(IRawVectorTileSource tileSource)

Parameters

tileSource IRawVectorTileSource
The tiles: a over feature sources, or an archive.

VectorTileOverlay(string, IRawVectorTileSource)

Creates an overlay under an id - the name its route goes by - that serves a tile source's tiles.

public VectorTileOverlay(string id, IRawVectorTileSource tileSource)

Parameters

id string
The name the application knows the overlay by.

tileSource IRawVectorTileSource
The tiles: a over feature sources, or an archive.

Methods

OpenAsync(CancellationToken)

Opens the tile source. The first tiles a page asks for arrive together, so the requests that find the overlay closed queue here and one of them opens it.

public Task OpenAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken
The request's token.

Returns

Task

Dispose()

Disposes the tile source when it can be, releasing the files it holds open. The overlay is finished with; make a new one to serve again.

public void Dispose()

Returns

void

GetTileAsync(int, long, long, CancellationToken)

One tile, gzipped: cut from the feature sources now, or read from the archive as it holds it. Null when there is nothing there - no features, or a zoom the source does not reach - which an action answers with 204.

public Task<Byte[]> GetTileAsync(int zoom, long x, long y, CancellationToken cancellationToken)

Parameters

zoom int
The tile's zoom level.

x long
The tile's column.

y long
The tile's row, counted from the top.

cancellationToken CancellationToken
The request's token; a browser that has moved on stops the cut.

Returns

Task<Byte[]>