项目 / BruTile/BruTile

BruTile/BruTile

行业推荐
语言 C#标签 brutilewmtswmsosmtmsmaptilingmapping数据更新 2026-11-13 19:42:00 · 仓库 2026-10-31

一段话介绍

面向 .NET Standard 2.0 的地图瓦片访问库,用来对接 OpenStreetMap、Bing 等预渲染瓦片服务。它负责构造瓦片源、按可视范围和分辨率计算所需瓦片,并获取原始图像流,本身不负责显示;显示需结合 SharpMap、Mapsui、ArcBruTile 等地图库,或自行编写界面。可用 NuGet 安装后按仓库入门示例开始。

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
BruTile is a .NET library to access tile services like those of OpenStreetMap, MapBox or GeodanMaps.
376累计星
118Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

库存与供应链协同

适配系统:库存管理系统、供应链协同平台 · 得分 1.4

覆盖库存台账与出入库流程,可作为仓内作业与上下游协同的业务底座。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
在 .NET 控制台应用中安装 BruTile 包后,可用 HttpTileSource 创建 OpenStreetMap 瓦片源,并按范围与分辨率获取瓦片信息。
特点或设计要点
当前主线是 BruTile V4,提供 BruTile 与 BruTile.MbTiles 两个支持 .NET Standard 2.0 的 NuGet 包。库不依赖特定客户端平台。除在线瓦片服务外,也可用 MBTiles 读取本机存储的瓦片。仓库 Samples 目录中有入门示例和演示。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-05-18 · 语言 C# · 贡献者 —
sdk

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 6,118 字节。

|   | Status  | 
| ------------- |:-------------:|
| Build | [![Build status](https://github.com/brutile/brutile/actions/workflows/build.yml/badge.svg)](https://github.com/BruTile/BruTile/actions/workflows/build.yml?query=branch%3Amaster) |
| NuGet BruTile | [![NuGet Status](http://img.shields.io/nuget/v/BruTile.svg?style=flat)](https://www.nuget.org/packages/BruTile/) |
| NuGet BruTile.MbTiles | [![NuGet Status](http://img.shields.io/nuget/v/BruTile.MbTiles.svg?style=flat)](https://www.nuget.org/packages/BruTile.MbTiles/) |

### BruTile
BruTile is a .NET Standard 2.0 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](https://github.com/Mapsui/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 V4** consists of 2 nugets that support .NET Standard 2.0.

| Library                  |   Targeted Framework  |
| ------------------------ | --------------------- |
| BruTile                  |  .NET Standard 2.0    |
| BruTile.MbTiles          |  .NET Standard 2.0    |

- Support for .NET Framework 4.5 has been removed (also the samples and tests have moved to .NET Core). 
- BruTile.Desktop and BruTile.Desktop.DbCache have been deleted and their content has moved to the BruTile nuget.

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

## Getting Started

### 1) Create an app and add the BruTile NuGet package
Create a .NET Console app in Visual Studio. Add 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
```c#
// 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
```c#
// 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

```c#
Console.WriteLine("Show tile info");
foreach (var tileInfo in tileInfos)
{
    var tile = await tileSource.GetTileAsync(tileInfo);

    Console.WriteLine(
        $"tile col: {tileInfo.Index.Col}, " +
        $"tile row: {tileInfo.Index.Row}, " +
        $"tile level: {tileInfo.Index.Level} , " +
        $"tile size {tile.Length}");
}
```
Output:
```console
    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 

```c#
// 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](https://github.com/BruTile/BruTile/blob/master/BruTile/Predefined/KnownTileSources.cs) 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.

```c#
var mbtilesTilesource = new MbTilesTileSource(new SQLiteConnectionString("Resources/world.mbtiles", false));
var mbTilesTile = await mbtilesTilesource.GetTileAsync(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:
```console
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:
* [WMTS](http://www.opengeospatial.org/standards/wmts)
* [TMS](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification)
* [OSM](http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) (Like TMS with inverted y-axis)
* [WMS](http://www.opengeospatial.org/standards/wms) (tiled requests to a regular WMS)
* [ArcGIS Tile Server](http://resources.arcgis.com/en/help/rest/apiref/tile.html)
* [WMS-C](https://wiki.osgeo.org/wiki/WMS_Tile_Caching#WMS-C_as_WMS_Profile)

### Roadmap
- Stability is currently our primary focus.

### Projects that use BruTile

* [ArcBruTile](https://bertt.itch.io/arcbrutile) a plugin for ArcGIS
* [SharpMap](https://github.com/SharpMap/SharpMap) a GIS library
* [Mapsui](https://github.com/Mapsui/Mapsui) a MapComponent for Xamarin.Android. Xamarin.iOS, UWP and WPF
* [DotSpatial](https://github.com/DotSpatial/DotSpatial) a GIS library that is used in [HydroDesktop](https://github.com/CUAHSI/HydroDesktop)

### License
[Apache 2.0](https://raw.githubusercontent.com/BruTile/BruTile/master/LICENSE.md)
↑