Skip to content

compassinformatics/tessera

Repository files navigation

![] (http://www.compass.ie/wordpress/wp-content/uploads/Compass-logo-Final-300x104.png)

Compass Tessera

Visit the demo website.

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.

Usage example

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);

Supported Platforms

  • .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.

Build

Compass Tessera is built using

  • Visual Studio 2013 or Xamarin Studio
  • The Xamarin framework

Sample Applications

This project contains two sample applications:

  1. An MVC web application
  2. 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.

MVC web application

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

Xamarin.Android App

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.

Known bugs and limitations

  • 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

TODO

  • Suite of unit tests
  • Support of different projections in the input file
  • Code cleanup

Credits

Libraries

Feedback

All bugs, feature requests, pull requests, feedback, etc., are welcome. Create an issue. Or ask a question on StackOverflow

License

Copyright 2014, Compass Informatics Ltd.

Licensed under the MIT License or see the LICENSE file.

Author

Logo

Copyright 2014, Compass Informatics Ltd.

Releases

No releases published

Packages

 
 
 

Languages