All Projects → BruTile → Brutile

BruTile / Brutile

Licence: apache-2.0
BruTile is a .NET library to access tile services like those of OpenStreetMap, MapBox or GeodanMaps.

Projects that are alternatives of or similar to Brutile

Mapserver
Source code of the MapServer project. Please submit pull requests to the 'main' branch.
Stars: ✭ 693 (+241.38%)
Mutual labels:  mapping, wms, map
Mapsui
Mapsui is a .NET Map component for WPF, Xamarin.Forms, Xamarin.Android, Xamarin.iOS and UWP
Stars: ✭ 447 (+120.2%)
Mutual labels:  mapping, osm, map
Joctomap
Java/Android wrapper for Octomap: an octree-based mapping library
Stars: ✭ 11 (-94.58%)
Mutual labels:  mapping, map
Svg World Map
🗺 A JavaScript library to easily integrate one or more SVG world maps with all nations (countries) and second-level political subdivisions (countries, provinces, states).
Stars: ✭ 38 (-81.28%)
Mutual labels:  mapping, map
Geoserver
Official GeoServer repository
Stars: ✭ 2,573 (+1167.49%)
Mutual labels:  mapping, wms
Leaflet.markercluster
Marker Clustering plugin for Leaflet
Stars: ✭ 3,305 (+1528.08%)
Mutual labels:  mapping, map
Iclient Javascript
Modern GIS Web Client for JavaScript, based on Leaflet\OpenLayers\MapboxGL-JS\Classic(iClient8C), enhanced with ECharts\D3\MapV etc. Contributed by SuperMap & community.
Stars: ✭ 593 (+192.12%)
Mutual labels:  mapping, map
Leaflet.labeltextcollision
Leaflet.LabelTextCollision is a LeafletJS plug-in to display labels on vector data while avoiding label collisions.
Stars: ✭ 65 (-67.98%)
Mutual labels:  mapping, map
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (-74.88%)
Mutual labels:  map, osm
Streetcomplete
Easy to use OpenStreetMap editor for Android
Stars: ✭ 2,456 (+1109.85%)
Mutual labels:  mapping, osm
Android
Android app for collecting OpenStreetCam imagery
Stars: ✭ 119 (-41.38%)
Mutual labels:  mapping, osm
Openrailwaymap
An OpenStreetMap-based project for creating a map of the world's railway infrastructure.
Stars: ✭ 150 (-26.11%)
Mutual labels:  mapping, map
turkeyvisited
Mark the cities you have visited in Turkey and share the map!
Stars: ✭ 82 (-59.61%)
Mutual labels:  map, mapping
Aphotomanager
Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
Stars: ✭ 164 (-19.21%)
Mutual labels:  osm, map
mbmatch
An MBTiles server for PBF, which is also a map matcher.
Stars: ✭ 34 (-83.25%)
Mutual labels:  map, osm
Lenz
Console based MAP 🗺 : with lots of features 🤩
Stars: ✭ 51 (-74.88%)
Mutual labels:  mapping, map
AndroidOfflineMapLibrary
Offline OpenStreet Map Library (No Internet Required) You dont have to even one-time connect!
Stars: ✭ 16 (-92.12%)
Mutual labels:  map, osm
leaflet.TravelNotes
A complete mapping application. With this, you prepare a complete travel, adding itineraries and personnal notes to the map. When you travel is complete, you can save it to a file, export the itineraries to a gpx files, print the itineraries and a roadbook with the notes and itineraries description.
Stars: ✭ 31 (-84.73%)
Mutual labels:  map, mapping
Cyclosm Cartocss Style
Cycle oriented CartoCSS style.
Stars: ✭ 109 (-46.31%)
Mutual labels:  osm, map
Libosmscout
Libosmscout is a C++ library for offline map rendering, routing and location lookup based on OpenStreetMap data
Stars: ✭ 159 (-21.67%)
Mutual labels:  osm, map
Status
Build Build status
NuGet NuGet Status

News

  • 2020 june 7: published a couple of new releases. They are based on just four PRs but because of semver they came out as three separate releases.
    • 2.1.3 with a small fix to allow case insensitive style in wmts.
    • 2.2.0 in which HttpTileSource.PersistentCache now has a setter.
    • 3.0.0 which has two breaking changes.
      • In MbTiles there is a change in the default behavior that some users might notice. Zoom levels are not calculated from the 'tiles' table by default.
      • The TileIndex.Level is now int instead of string. Most users will not notice this unless you write logic around tiling itself.

BruTile

BruTile is a .NET Standard 1.1 library to access tile services like OpenStreetMap and Bing. Such tile services store pre-rendered tiles for a certain area and for various levels of detail. BruTile helps to determine which tiles to fetch for a certain viewport of a map. BruTile returns tiles as raw image streams and has no dependency on a specific client platform. BruTile does not display those tiles. You need to use a mapping library like SharpMap, ArcBruTile or Mapsui or write your own code to display tiles.

What BruTile does is:

  1. Helps to construct a tile source, an object that has all information about a tile service.
  2. Helps to calculate which tiles you need, given a certain map extent and a map resolution (units per pixel).
  3. Helps you fetch those tiles.

BruTile is a .NET Standard library

BruTile 2.0 supports .NET Standard. The Profiles by NuGet package:

Library Targeted Framework
BruTile .NET Standard 1.1
BruTile.MbTiles .NET Standard 1.1
BruTile.Desktop .NET Standard 1.6
BruTile.Desktop.DbCache .NET Standard 2.0

All the above libraries additionally target .Net Framework 4.5

Demo

For a demo showing various data sources download the source code and run BruTile.Demo in the Samples folder

Getting Started

Binder

1) Create an app and add the BruTile NuGet package

Create a .NET Console app in Visual Studio. The the BruTile NuGet package. Use the package manager tools in Visual Studio or add it from the package manager console:

PM> install-package BruTile 

2) Create a tile source

// This is an example that creates the OpenStreetMap tile source:
var tileSource = new HttpTileSource(new GlobalSphericalMercator(0, 18),
    "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    new[] {"a", "b", "c"}, "OSM");

3) Calculate which tiles you need

// the extent of the visible map changes but lets start with the whole world
var extent = new Extent(-20037508, -20037508, 20037508, 20037508);
var screenWidthInPixels = 400; // The width of the map on screen in pixels
var resolution = extent.Width / screenWidthInPixels;
var tileInfos = tileSource.Schema.GetTileInfos(extent, resolution);

4) Fetch the tiles from the service

Console.WriteLine("Show tile info");
foreach (var tileInfo in tileInfos)
{
    var tile = tileSource.GetTile(tileInfo);

    Console.WriteLine(
        $"tile col: {tileInfo.Index.Col}, " +
        $"tile row: {tileInfo.Index.Row}, " +
        $"tile level: {tileInfo.Index.Level} , " +
        $"tile size {tile.Length}");
}

Output:

    tile col: 0, tile row: 0, tile level: 1 , tile size 11276
    tile col: 0, tile row: 1, tile level: 1 , tile size 3260
    tile col: 1, tile row: 0, tile level: 1 , tile size 10679
    tile col: 1, tile row: 1, tile level: 1 , tile size 4009

5) Try some of the known tile sources

// You can easily create an ITileSource for a number of predefined tile servers
// with single line statements like:
var tileSource1 = KnownTileSources.Create(); // The default is OpenStreetMap
var tileSource2 = KnownTileSources.Create(KnownTileSource.BingAerial);
var tileSource3 = KnownTileSources.Create(KnownTileSource.BingHybrid);
var tileSource4 = KnownTileSources.Create(KnownTileSource.StamenTonerLite);
var tileSource5 = KnownTileSources.Create(KnownTileSource.EsriWorldShadedRelief);

The predefined tile sources are defined in a single file. Take a look at that file here to learn how you could create any tile source.

6) Use MBTiles, the sqlite format for tile data, to work with tiles stored on your device.

var mbtilesTilesource = new MbTilesTileSource(new SQLiteConnectionString("Resources/world.mbtiles", false));
var mbTilesTile = mbtilesTilesource.GetTile(new TileInfo { Index = new TileIndex(0, 0, 0) });
Console.WriteLine($"This is a byte array of an image file loaded from MBTiles with size: {mbTilesTile.Length}");

Output:

This is a byte array of an image file loaded from MBTiles with size: 27412

The above code can also be found in the BruTile sample called BruTile.GettingStarted in the Samples folder of this repository.

Supported tile service protocols:

Roadmap

  • Stability is currently our primary focus.

Projects that use BruTile

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].