User Manual

Adding a Mapbox LayerSource

Mapbox provides a number of attractive tile-sets that can be used out-of the box in Mapzania.

To use Mapbox tile-sets as background layers-sources, you need to create an account on the Mapbox website. You will then have access to all the standard Mapbox tile-sets in addition to having the ability to create your own tilesets.

Adding a Mapbox tile-set to use as a background layer-source is easily done using a few lines of code.

This is illustrated in the example below:


void Application_Start(object sender, EventArgs e)

    // Set options for the Mapbox layer-source
    var options = new Platform.Mapbox.LayerSourceOptions {
        MapId = "mapbox.satellite",
        AccessToken = "[Your Mapbox Access Token]"
    // Register the Mapbox layer-source
    Mapzania.Services.RegisterMapboxLayerSource("MAPBOX_SATELLITE", options);
    // Start Mapzania

NOTE: It is important that the Mapzania.Services.RegisterMapboxLayerSource method be called before the Mapzania.Services.Start method. If this is not done, the layer-source will not be activated.

See Mapzania.Services.RegisterMapboxLayerSource for reference documentation.