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 MSSQL Spatial LayerSources
Adding MSSQL Spatial tables as Mapzania LayerSources can take as little as one line of code in the startup section of your application. This is illustrated in the examples below:
Default Registration
To register all MSSQL Spatial tables in a database using default options add the code highlighted below to your startup code:
void Application_Start(object sender, EventArgs e)
{
...
// Obtain a connectionstring from ConfigurationManager (web.config)
var connectionString = ConfigurationManager.ConnectionStrings["MY_CONNECTION"].ConnectionString;
// Register the MSSQl Spatial database
Mapzania.Services.RegisterMsSqlSpatialDatabase(connectionString);
// Start Mapzania
Mapzania.Services.Start(this);
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
...
}
NOTE: It is important that the Mapzania.Services.RegisterMsSqlSpatialDatabase method be called before the Mapzania.Services.Start method. If this is not done, the MsSqlSpatial database will not be activated.
Registration with Options
To register all MSSQL Spatial tables in a database using custom options add the code highlighted below to your startup code:
void Application_Start(object sender, EventArgs e)
{
...
// Obtain a connectionstring from ConfigurationManager (web.config)
var connectionString = ConfigurationManager.ConnectionStrings["MY_CONNECTION"].ConnectionString;
// Set options for MSSQL Spatial LayerSources
var options = new Platform.MsSqlSpatial.ProviderOptions {
Prefix = "MYDB_",
DefaultSRID = "EPSG:4283",
DefaultIdColumnName = "MY_ID",
DefaultGeometryColumnName = "MY_GEOMETRY"
};
// Register the MSSQl Spatial database
Mapzania.Services.RegisterMsSqlSpatialDatabase(connectionString, options);
// Start Mapzania
Mapzania.Services.Start(this);
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
...
}
See Mapzania.Services.RegisterMsSqlSpatialDatabase for reference documentation.