RegisterMapboxLayerSource
This method is used to register a single Mapbox layer-source.
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.
NOTE: Please note that it is your responsibility to comply with all licensing and legal issues relating to Mapbox.
Parameters
Name | Required | Type | Description |
---|---|---|---|
key | Yes | String | This is the layer-source key that will be used to identify the Mapbox layer. |
options | Yes | Mapzania.Platform.Mapbox.LayerSourceOptions | Options for registering the layer-source (see below for more details). |
Options
Name | Default | Required | Type | Description |
---|---|---|---|---|
MapId | null | Yes | String | The Mapbox Map Id for example 'mapbox.satellite'. |
AccessToken | null | Yes | String | The Mapbox Access Token that is provided to you when you register on their site. |
Example
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
Mapzania.Services.Start(this);
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
...
}