User Manual

Adding a TomTom LayerSource

TomTom provides two APIs that work well as background tiles for Mapzania maps, namely:

To use TomTom layers as background layers-sources, you need to create an account on the TomTom Developer Site.

Adding the different kinds of TomTom layers as background layer-source is easily done using a few lines of code.

This is illustrated in the examples below:

Example - Online Map


void Application_Start(object sender, EventArgs e)
{
	...

    // Set options for the TomTom layer-source
    var options = new Platform.TomTom.MapLayerSourceOptions {
        ApiKey = "[Your TomTom API Key]",
        Layer = Platform.TomTom.MapLayerSourceOptions.LayerEnum.Basic,
        Style = Platform.TomTom.MapLayerSourceOptions.StyleEnum.Night,
        View = "NGT",
        Language = "fr-FR"        
    }
    
    // Register the TomTom layer-source
    Mapzania.Services.RegisterTomTomMapLayerSource("TOMTOM_TILES_NIGHT", options);
    
    // Start Mapzania
    Mapzania.Services.Start(this);
    
    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    ...
}

Example - Online Traffic Flow


void Application_Start(object sender, EventArgs e)
{
	...

    // Set options for the TomTom layer-source
    var options = new Platform.TomTom.TrafficFlowLayerSourceOptions {
        ApiKey = "[Your TomTom API Key]",
        Style = Platform.TomTom.TrafficFlowLayerSourceOptions.StyleEnum.Absolute,
        Thickness = 15
    }
    
    // Register the TomTom layer-source
    Mapzania.Services.RegisterTomTomTrafficFlowLayerSource("TOMTOM_FLOWS", options);
    
    // Start Mapzania
    Mapzania.Services.Start(this);
    
    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    ...
}

Example - Online Traffic Incidents


void Application_Start(object sender, EventArgs e)
{
	...

    // Set options for the TomTom layer-source
    var options = new Platform.TomTom.TrafficIncidentsLayerSourceOptions {
        ApiKey = "[Your TomTom API Key]",
        Style = Platform.TomTom.TrafficIncidentsLayerSourceOptions.StyleEnum.S3
    }
    
    // Register the TomTom layer-source
    Mapzania.Services.RegisterTomTomTrafficIncidentsLayerSource("TOMTOM_TRAFFIC", options);
    
    // Start Mapzania
    Mapzania.Services.Start(this);
    
    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    ...
}

Reference Documentation