Tile Map Service for .NET 5
Basic implementation of tile server for .NET 5 platform. Provides access to tiles stored in several source types and serving them using various protocols.
Demo page
Features
- Supported tile sources:
Source type | EPSG:3857 | EPSG:4326 | Notes |
---|---|---|---|
Local file system | ✓ | ✓ | Each tile in separate file in Z/X/Y.ext folder structure |
MBTiles (SQLite) | ✓ | — | MBTiles 1.3 Specification |
GeoTIFF local file | ✓ | ✓ | GeoTIFF basic support with EPSG:3857 or EPSG:4326 source image SRS only |
XYZ tile service | ✓ | ✓ | XYZ with local cache for EPSG:3857 SRS |
TMS tile service | ✓ | ✓ | TMS with local cache for EPSG:3857 SRS |
WMTS tile service | ✓ | ✓ | WMTS with local cache for EPSG:3857 SRS |
WMS service | ✓ | — | WMS, WMS versions 1.1.1 and 1.3.0, cache for EPSG:3857 SRS |
PostGIS database | ✓ | — | Mapbox Vector Tiles from geometry column with EPSG:3857 SRS only |
- Supported protocols (service endpoints) for serving tiles:
Type | EPSG:3857 | EPSG:4326 | Endpoint | Formats | Notes |
---|---|---|---|---|---|
XYZ (Tiled web map) | ✓ | ✓ | /xyz | png, jpeg, webp, mvt | Can be REST style url (/{z}/{x}/{y}.ext) or url with parameters (&x={x}&y={y}&z={z}) |
TMS (Tile Map Service) | ✓ | ✓ | /tms | png, jpeg, webp, mvt | |
WMTS (Web Map Tile Service) | ✓ | — | /wmts | png, jpeg, webp, mvt | Support both RESTful and KVP GetTile url syntax |
WMS (Web Map Service) | ✓ | — | /wms | png, jpeg, tiff | WMS versions 1.1.1 and 1.3.0 |
- Coordinate system / tile grid support: Web Mercator / Spherical Mercator / EPSG:3857, basic support for geodetic
EPSG:4326
. - Tile image formats: raster (
PNG
,JPEG
,WEBP
) 256×256 pixels tiles, basic support ofTIFF
output andPBF
/MVT
(vector tiles). - Local cache for tiles from external tile services sources (modified
mbtiles
format database file,EPSG:3857
only), with blank tiles detection support. - Configuration in JSON file.
Technologies
Developed using MS Visual Studio 2019 with .NET 5 SDK. Using
- Microsoft.Data.Sqlite for working with SQLite database.
- SkiaSharp for raster images processing.
- BitMiracle.LibTiff.NET for reading source GeoTIFF files and creating output TIFF images.
- Npgsql .NET data provider for PostgreSQL.
- Leaflet for map demo page.
- NUnit for tests.
Configuration file
Tile sources are defined in appsettings.json configuration file.
Running framework-dependent deployment
Check presence of .NET 5 runtime on target system using command:
dotnet --info
The Microsoft.AspNetCore.App 5.0.3
(or later version) should present in list.
Run the application using command:
dotnet TileMapService.dll
After start, it will listen on default TCP port 5000 (using in-process Kestrel
web server)
and tile service with demo page will be available on http://localhost:5000/ address; to enable remote calls allow connections to this port in firewall settings.
TODOs
- Support for more formats (image formats, vector tiles) and coordinate systems (tile grids).
- Include test dataset(s) created from free data.
- WMS and Vector Tiles (mvt) client in Web UI.
- Flexible settings of tile sources.
- Compare with reference implementations.
- Using metatiles for better tiles quality.
- Configuration Web UI.
- Extended diagnostics, error handling and logging.
- Performance tests.
- Live demo.
Some MBTiles sample datasets
- World Countries MBTiles by ArcGIS / EsriAndroidTeam
- Satellite Lowres raster tiles Planet by MapTiler
- Custom vector tiles from Georaphy Class example MVT
All external tile sources (services) in the provided appsettings.json
file are only for development / testing, not for production use.