Show / Hide Table of Contents

Class Map<T>

The Mapbox Map abstraction will take care of fetching and decoding data for a geographic bounding box at a certain zoom level.

Inheritance
System.Object
Map<T>
Namespace:Mapbox.Map
Assembly:Mapbox.Map.dll
Syntax
public sealed class Map<T> : object, IObservable<T> where T : Tile, new ()
Type Parameters
Name Description
T

The tile type, currently Mapbox.Map.Vector or Mapbox.Map.Raster.

Examples

Request a map of the whole world:

var map = new Map<RasterTile>(MapboxAccess.Instance);
map.Zoom = 2
map.Vector2dBounds = Vector2dBounds.World();
map.MapId = "mapbox://styles/mapbox/streets-v10

// Register for tile updates.
map.Subscribe(this);

// Trigger the request.
map.Update();

Constructors

Map(IFileSource)

Initializes a new instance of the Map<T> class.

Declaration
public Map(IFileSource fs)
Parameters
Type Name Description
IFileSource fs

The data source abstraction.

Fields

TileMax

Arbitrary limit of tiles this class will handle simultaneously.

Declaration
public const int TileMax = null
Field Value
Type Description
System.Int32

Properties

Center

Gets or sets the central coordinate of the map.

Declaration
public Vector2d Center { get; set; }
Property Value
Type Description
Vector2d

The central coordinate.

MapId

Gets or sets the tileset map ID. If not set, it will use the default map ID for the tile type. I.e. "mapbox.satellite" for raster tiles and "mapbox.mapbox-streets-v7" for vector tiles.

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

The tileset map ID, usually in the format "user.mapid". Exceptionally, RasterTile will take the full style URL from where the tile is composited from, like "mapbox://styles/mapbox/streets-v9".

Tiles

Gets the tiles, vector or raster. Tiles might be in a incomplete state.

Declaration
public HashSet<T> Tiles { get; }
Property Value
Type Description
HashSet<T>

The tiles.

Vector2dBounds

Gets or sets a geographic bounding box.

Declaration
public Vector2dBounds Vector2dBounds { get; set; }
Property Value
Type Description
Vector2dBounds

New geographic bounding box.

Zoom

Gets or sets the map zoom level.

Declaration
public int Zoom { get; set; }
Property Value
Type Description
System.Int32

The new zoom level.

Methods

SetVector2dBoundsZoom(Vector2dBounds, Int32)

Sets the coordinates bounds and zoom at once.

Declaration
public void SetVector2dBoundsZoom(Vector2dBounds bounds, int zoom)
Parameters
Type Name Description
Vector2dBounds bounds

Coordinates bounds.

System.Int32 zoom

Zoom level.

Subscribe(IObserver<T>)

Add an IObserver to the observer list.

Declaration
public void Subscribe(IObserver<T> observer)
Parameters
Type Name Description
IObserver<T> observer

The object subscribing to events.

Implements
IObservable<T>.Subscribe(IObserver<T>)

Unsubscribe(IObserver<T>)

Remove an IObserver to the observer list.

Declaration
public void Unsubscribe(IObserver<T> observer)
Parameters
Type Name Description
IObserver<T> observer

The object unsubscribing to events.

Implements
IObservable<T>.Unsubscribe(IObserver<T>)

Update()

Request tiles after changing map properties.

Declaration
public void Update()
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX