![] (http://www.compass.ie/wordpress/wp-content/uploads/Compass-logo-Final-300x104.png)
Compass Tessera (as in Tessera) is a simple shapefile tile engine written in C#. The purpose of the library is to provide an easy way to render a shapefile into tiles that can be used as an overlay on Google Maps or similar services. It's currently being used by 30 Local Authorities in Ireland as part of the PMS project to display the official road network on an Android application operating offline.
TinyIoC.TinyIoCContainer.Current.AutoRegister();
TinyIoC.TinyIoCContainer.Current.Register<TileGenerator>().AsSingleton();
var tileGenerator = TinyIoC.TinyIoCContainer.Current.Resolve<TileGenerator>();
tileGenerator.Setup(HostingEnvironment.MapPath("~/"), "roads.shp");
and then
var memoryStream = tileGenerator.GetTile(7910,5314,14);
- .NET 4.5 (Desktop / Server)
- Xamarin.Android (probably also Xamarin.iOS and Xamarin.Mac)
The application relies on dependency injection to support multiple platforms. The IoC container used in the sample applications is TinyIoC.
Compass Tessera is built using
- Visual Studio 2013 or Xamarin Studio
- The Xamarin framework
This project contains two sample applications:
- An MVC web application
- A Xamarin.Android app
NOTE You will have to generate a Google Maps API key for both applications in order to use the Google Maps control.
The application provides a single page with a Google Map set up with a custom tile overlay. A WebAPI web service is used to serve the tiles with a simple url scheme
http://localhost/api/tile/gettile?x=7910&y=5314&zoomLevel=14
The app displays a full screen Google Maps map (Google Maps Api V2) and it's set up to generate the tiles on the device. The big advantage is that the background mapping is not necessary to display the tiles, making the tile generation fully working offline. After deploying the app to the device, copy the the roads.* files in the Maps folder of the web application into the root folder of the device.
- The library currently supports only WGS84 -EPSG:4326 as input shapefiles.
- The style of the lines is hardcoded
- There is a small gap between tiles
- Suite of unit tests
- Support of different projections in the input file
- Code cleanup
- NetTopologySuite
- GeoFabrik for the Ireland road map shapefile used in the sample applications.
- The application is using the portable version of the NetTopologySuite library and its dependencies. For convenience the compiled assemblies are available in this repository.
- Proj.Net
- GeoAPI.NET
- TinyIoC
All bugs, feature requests, pull requests, feedback, etc., are welcome. Create an issue. Or ask a question on StackOverflow
Copyright 2014, Compass Informatics Ltd.
Licensed under the MIT License or see the LICENSE
file.
Copyright 2014, Compass Informatics Ltd.