19. 使用矢量瓦片

19.1. 什么是矢量瓦片?

矢量瓦片是地理数据包,打包成预定义的大致正方形的 "瓦片" ,便于在Web传输。结合了预渲染的栅格地图瓦片和矢量地图瓦片。矢量瓦片服务器返回矢量地图数据,该数据已被裁剪到每个瓦片的边界,而不是预渲染的地图图像。裁剪的瓦片表示矢量瓦片服务的缩放级别,该缩放级别源自金字塔方式。与非瓦片的矢量地图相比,使用此结构可以减少数据传输。只需传输当前地图视图以及当前缩放级别的数据。此外,与瓦片栅格地图相比,数据传输也大大减少,因为矢量数据通常比渲染的位图小得多。矢量瓦片未分配任何样式信息,因此QGIS需要应用制图样式来显示数据。

../../../_images/vector_tiles_pyramid_structure.png

图 19.1 具有缩放级别的矢量瓦片的金字塔结构

19.2. 支持的格式

通过以下方式支持矢量瓦片:

  • 远程源 (HTTP/S) - 使用XYZ模板 - type=xyz&url=http://example.com/{z}/{x}/{y}.pbf

  • 本地文件 - 使用XYZ模板 - 例如: type=xyz&url=file:///path/to/tiles/{z}/{x}/{y}.pbf

  • 本地MBTile数据库 - 例如: type=mbtiles&url=file:///path/to/file.mbtiles

要将矢量瓦片数据集加载到QGIS,请使用 数据源管理器 对话框中的 addVectorTileLayer 矢量瓦片 选项卡。更多信息,请参阅 使用矢量瓦片服务

19.3. 矢量瓦片数据集属性

19.3.1. 信息属性

Information 选项卡为只读状态,这是引人关注的位置,可以快速获取当前图层的摘要信息和元数据。提供的信息包括:

  • 基于图层的提供程序:名称、URI、源类型和路径、缩放级别的数量

  • 坐标参照系:名称、单位、方法、精度、参照 (即静态还是动态)

  • 已填充的元数据 中提取:访问、范围、链接、联系人、历史记录等

19.3.2. 符号化和标注属性

../../../_images/vector_tiles_symbology.png

图 19.2 矢量瓦片图层符号化

As vector tiles consist of point, line and polygon geometries, the respective symbols are available. To apply a cartographic style you need to use a Style URL when creating the Vector Tiles Connection. The symbology will be shown immediately in the symbology Symbology tab after clicking the OK button.

To create your own cartographic style you can define a set of rules for features and apply style and label. In 图 19.2 we set up style and labeling for the OpenStreetMap landuse layer. The settings are made for the class suburb here. For better visibility most of the rules are deselected.

At the bottom the Current Zoom is shown. Check the Visible rules only option to filter the list of rules to only those that are visible at the given zoom level. This makes it easier to work with complex vector styling and to locate troublesome rules. Style and labelling can be dependent on the zoom level.

There is also the option to import styles. Those styles can be supplied as:

19.3.3. 元数据属性

The editMetadata Metadata tab provides you with options to create and edit a metadata report on your layer. See 元数据 for more information.