User Manual
Concepts
Get Started
- Pre-Requisites
- Install the NuGet Package
- Obtain Leaflet
- Obtain a License
- Initialize Mapzania
- Initialize Endpoints
- Adding a JavaScript Reference
- Add a Map to a Web Page
- Add Data to a Map
- Style a Map
- Further Reading
JavaScript Client
- Introduction
- Creating a Map Object
- Customize the Map Toolbar
- Map Events
- Mouse and Drawing Behaviour
- Map Extents
- Refresh/Reset the Map
- Working with Layers
- Displaying Layers
- Working with Layer Data
- Styling Layers
- Transforming Layers
- Working with Features
- Displaying Features
- Styling Features
- Working with the QueryEngine
DotNet Server
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);
...
}