Show / Hide Table of Contents

Class VectorTile

A decoded vector tile, as specified by the Mapbox Vector Tile specification. See available layers and features here. The tile might be incomplete if the network request and parsing are still pending.

Inheritance
System.Object
Tile
VectorTile
Inherited Members
Tile.Id
Tile.Error
Tile.SetError(String)
Tile.CurrentState
Tile.Initialize(Tile.Parameters, Action)
Tile.ToString()
Tile.Cancel()
Tile.SetState(Tile.State)
Namespace:Mapbox.Map
Assembly:Mapbox.Map.dll
Syntax
public sealed class VectorTile : Tile, IDisposable
Examples

Making a VectorTile request:

var parameters = new Tile.Parameters();
parameters.Fs = MapboxAccess.Instance;
parameters.Id = new CanonicalTileId(_zoom, _tileCoorindateX, _tileCoordinateY);
parameters.MapId = "mapbox.mapbox-streets-v7";
var vectorTile = new VectorTile();

// Make the request.
vectorTile.Initialize(parameters, (Action)(() =>
{
    if (!string.IsNullOrEmpty(vectorTile.Error))
    {
        // Handle the error.
    }

    // Consume the Data.
}));

Properties

Data

Gets the vector decoded using Mapbox.VectorTile library.

Declaration
public VectorTile.VectorTile Data { get; }
Property Value
Type Description
Mapbox.VectorTile.VectorTile

The GeoJson data.

GeoJson

Gets the vector in a GeoJson format.

This method should be avoided as it fully decodes the whole tile and might pose performance and memory bottle necks.

Declaration
public string GeoJson { get; }
Property Value
Type Description
System.String

The GeoJson data.

Examples

Inspect the GeoJson.

var json = VectorTile.GeoJson;
Console.Write("GeoJson: " + json);

Methods

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
public void Dispose(bool disposeManagedResources)
Parameters
Type Name Description
System.Boolean disposeManagedResources

GetLayer(String)

Decodes the requested layer.

Declaration
public VectorTileLayer GetLayer(string layerName)
Parameters
Type Name Description
System.String layerName

Name of the layer to decode.

Returns
Type Description
VectorTileLayer

Decoded VectorTileLayer or 'null' if an invalid layer name was specified.

Examples

Inspect a layer of the vector tile.

var countryLabelLayer = vectorTile.GetLayer("country_label");
var count = countryLabelLayer.Keys.Count;
for (int i = 0; i < count; i++)
{
    Console.Write(string.Format("{0}:{1}", countryLabelLayer.Keys[i], countryLabelLayer.Values[i]));
}

LayerNames()

Gets all availble layer names. See available layers and features here.

Declaration
public ReadOnlyCollection<string> LayerNames()
Returns
Type Description
ReadOnlyCollection<System.String>

Collection of availble layers.

Examples

Inspect the LayerNames.

var layerNames = vectorTile.LayerNames();
foreach (var layer in layerNames)
{
    Console.Write("Layer: " + layer);
}
In This Article
  • Properties
    • Data
    • GeoJson
  • Methods
    • Dispose()
    • Dispose(Boolean)
    • GetLayer(String)
    • LayerNames()
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX