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
Initialize Endpoints
Method 1 - .NET MVC Projects without WebApi
To initialize the Mapzania endpoints, add the highlighted code to the Application_Start method in your global.asax file:
protected void Application_Start()
{
Mapzania.Services.Start(this);
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
Mapzania.Services.RegisterRoutes(GlobalConfiguration.Configuration);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Method 2 - .NET MVC Projects with WebApi
To initialise the Mapzania endpoints, add the highlighted code to the Register method in your WebApiConfig.cs file (located in the App_Start folder):
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
Mapzania.Services.RegisterRoutes(config);
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
Build your application.
To test that the endpoints have been added successfully, try this url on your site: http://[your site]/mz/maps. If the endpoint is working successfully, you should see JSON data.
NOTE: The initialization calls made in your global.asax or WebApiConfig.cs file may differ slightly from the examples above.
This is not serious.
What is vital that you place this line after you map the http routes (by calling config.MapHttpAttributeRoutes()) and before you define your default route (by calling config.Routes.MapHttpRoute). If this is not done, the Mapzania endpoints may not initialize correctly.
See the REST Documentation for more details on the endpoints that are now available in your project.