Zh-hans:Standard tile layer
标准瓦片层 OpenStreetMap Carto,osm-carto | |
---|---|
![]() Baclaran, Paranaque and Pasay Rotunda, Pasay | |
作者: | Andy Allan 与 other contributors GitHub |
Slippy map: | www |
Usage policy: | operations |
Tiles license: | CC-BY-SA 2.0 |
Style website: | gravitystorm/openstreetmap-carto GitHub |
Style license: | CC0 1.0 GitHub |
版本: | 5.8.0 releases (2023-11-26) |
标准瓦片层是 OpenStreetMap 默认的瓦片层。通常也因样式表的名字(OpenStreetMap Carto GitHub)[1] 而被简称为 OSM Carto 或 osm-carto。
要报告问题可以在这里 GitHub(仅限样式问题,例如:特定物品的渲染问题)或这里 GitHub(报告在OSM.org, caching等地方的某个特定瓦片渲染问题)……两个网址都需要GitHub账号。
OSM 服务器部署
OSM 瓦片服务器从2013年8月就持续使用 OpenStreetMap Carto 样式。OSM tileserver生成统计在运行中,你也可以了解瓦片渲染处理。
低到中的缩放等级(z0-z12)瓦片通常只有在每月第一个星期天部署新的 OSM Carto 版本时才会被重新渲染[2]。数据库架构调整不应多于每年1-2次(通常配合 PostgreSQL 主要更新)。
如果要在其他应用里使用 openstreetmap.org 瓦片服务器的标准瓦片,必须要遵循Tile usage policy。
地图关键字
鉴于样式的特点比较丰富,OSM.org 体现出来的关键字十分有限,请查看Standard tile layer/Key及其子页面以获取最完整及最新的版本:
- 主条目:SymbolsTab
- 主条目:LinesTab
- 主条目:AreasTab
主要变更
![](https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Osm-carto_compare_2017.jpg/300px-Osm-carto_compare_2017.jpg)
- 2012 - 将 XML 版本移植为 CartoCSS(OSM Carto 的开始)
- 2013 - 部署 OSM 瓦片服务器
- 2014 - 重写建筑部分代码
- 2015 - 调整道路样式、SVG图标
- 2016 - 更好的地名渲染
- 2017 - 水域颜色,中缩放等级提升,数据库架构变更
- 2018 - 办公室及卫生机构关键字渲染,新 POI 颜色分类
技术细节
设计
该样式是为了通用世界地图而设计的,例如:
- 特殊的物件(如不会渲染海上标志或者铁路细节)不会被渲染
- 标识会以name=*的值来渲染(无论其值如何),所以不会全世界都显示英文名称
- 没有特定国家的标识(比如路障或者地铁标志),它们都有统一的外观
尽管 OpenStreetMap Carto 试图展现尽可能多的物件,渲染数据库里的所有东西仍然是不可能的,所以进行了挑选。
各个放缩等级的使用情况 GitHub被定好了。
Mapnik 与 CartoCSS
OpenStreetMap Carto 瓦片通过 Mapnik 工具集进行渲染,也就是说,OpenStreetMap Carto 与 Mapnik 不是同一个东西!Mapnik 是一个被许多地图样式表(包括OpenStreetMap Carto)使用了的地图渲染库。
CartoCSS 是用来将样式表预处理为 Mapnik XML格式(2013年8月起)。
渲染顺序
这个样式有许多个层次。比如水路的名称渲染在水路上面,商店渲染在建筑物上面,隧道渲染在建筑物上面,道路渲染在地表上面等等。
目前的问题是同一层次内的物件该怎么渲染。比如某些情况下,物件不能碰撞,以及覆盖已渲染对象的给定层级的物件未渲染。例如,对于城市,较小的标签与较大的标签相冲突时,不会渲染。
地覆盖区域按面积排序,较小的区域排在后面,允许碰撞。这意味着对于给定的图层,较小的区域将覆盖较大的区域。
例如,小型休闲公园leisure=park区域将被渲染在更大的leisure=residential区域上。
也存在一个单独的叠加层,例如包含森林土地覆盖的树木符号,该层在土地覆盖填充上渲染。
- 被小的landuse=forest和大的landuse=residential覆盖的区域
- 森林填充将渲染在住宅填充之上并覆盖它,稍后森林叠加将渲染在其上
- 被大的landuse=forest和小的landuse=residential覆盖的区域
- 住宅填充将覆盖森林填充并覆盖它,稍后森林叠加将覆盖其上
数据库
OpenStreetMap Carto 使用其标准数据库为 PostgreSQL,并带有 PostGIS 地理空间扩展,名称为"gis"。它源自 OSM 数据库,但不存储完整数据集 - 只提供与渲染相关的元素。自 v4.0.0 以来,OpenStreetMap Carto 使用 PostgreSQL 的 hstore(扩展和数据类型),并由 osm2pgsql 工具使用 lua脚本 GitHub 进行预处理。
Code structure
General project configuration is included in project.mml GitHub (YAML). There are defined so called "layers", which include mainly SQL statements selecting the objects, while actual styling is done in multiple MSS files.
Roads code is very complex and is partially generated by the helper scripts.
Icons and patterns
图标是像素对齐的矢量图像(SVG),通常基于 14 像素矩阵。虽然它们大多是单色的,其渲染颜色在 MSS 文件中定义,但在某些情况下,一些图标有多种颜色,并在矢量文件中自行定义。可能使用半色调。
有些图案也是以矢量图像的形式制作的,但如果它们仍然是光栅图像(PNG),它们也是从矢量元素中衍生出来的,而且制作过程都有记录,所以在可能的情况下,迁移到矢量格式应该很容易。
字体
尽可能使用 Noto 字体,同时使用 DejaVu Sans、Hanazono 和 Unifont 作为备用字体。
External sources
The style relies partly on some external data files coming from Natural Earth and preprocessed OSM data repository OpenStreetMapData. They can be updated with a Python script (scripts/get-shapefiles.py GitHub) or by hand.
Rendering coastline on openstreetmap.org is described here: Coastline#Rendering_in_Standard_tile_layer_on_openstreetmap.org.
Contributing and installing
You can set up a copy of the OpenStreetMap Carto rendering stylesheets for yourself. For more technical information, including setup instructions, see gravitystorm/openstreetmap-carto GitHub on GitHub:
- Contribution guidelines are documented here GitHub.
- One can set a simple Docker-based environment GitHub for testing.
- Some easy tasks GitHub has been selected for getting started with the process.
If you still don't know where to start, just ask for the assistance (for example in the ticket comments).
More experienced developers are also very welcomed. Some complex tasks that need attention are:
- Migration to vector tiles GitHub
- Low zoom improvements GitHub
- Roads modernization GitHub
Forks and independent deployments
Apart from OSM.org deployment, osm-carto is being used for different independent services, like OSM Japan or Geofabrik Maps.
OpenStreetMap Carto is used as a base for other map style rendering forks, especially:
- German osm-carto style (does also contain a branch with a localized version of OpenStreetMap Carto)
- French osm-carto style GitHub
- British osm-carto style (AJT) GitHub
- Swiss osm-carto style GitHub
- Belgian osm-carto style GitHub
- Japan fork of XML style GitHub (before osm-carto)
- osm-carto vector-tiles GitHub
- Style for Hi-res (retina) displays GitHub
- Style for the Sahara and other desertic regions GitHub
- Style in black and white GitHub
- Style for displaying and exporting contour data GitHub
- imagico fork for testing different cartography ideas GitHub
- Vector map basing on OSM Carto cartography by Esri
There is also a separate project called OpenGeofiction (OGF), which uses OSM tools - including osm-carto as default style - for creating maps of fictional places.
External links
General:
- Topic on OSM forum
- Current project activity GitHub
- OpenStreetMap Carto Tutorials - unofficial documentation (by Ircama)
- Docker things for openstreetmap carto GitHub - independent Docker environment (by OnkelTem)
- Tutorial about how to render on a map road line surfaces GitHub (by Lukas Sommer)
- Pre-rendered low zoom tiles (by Paul Norman)
- check current released github-carto-version GitHub and current used carto-version on https://osm.org, see
git-chef line 109 (109 :revision => "vx.xx.x",)
History:
- Timelapse videos of changes in osm-carto 2012-2016 (by Michael Glanznig)
- Old XML format Mapnik stylesheets for OpenStreetMap "standard" style GitHub
- Custom map style (1) - tweaking the standard OpenStreetmap style for the old, pre-2012 XML format (by Volker Schatz)
Blog posts:
- OpenStreetMap Carto Complexity (Paul Norman blog, 2015)
- OpenStreetMap-Carto – a look back at the last year (Christoph Hormann blog, 2017)
- OpenStreetMap-Carto – a look into the future (Christoph Hormann blog, 2017)
- Adding a change to "OSM Carto" (Andy Townsend diary, 2017)
Talks:
- Andy Allan talks: SoTM US 2013, SoTM EU 2014, SoTM US 2015
- Rory McCann talk on SoTM 2016 ("Converting a regular carto project to vector tiles: OSM-carto case study")
- Paul Norman talk on SoTM 2017
Footnotes
|