矢量瓦片 map-mvt
2026年7月20日大约 2 分钟
矢量瓦片 map-mvt
MVT 矢量瓦片图层。
放在
map-2d的pieces里;enabled写在节点顶层。数据来源data-input:bind-fields(绑工程连接)或source(引用数据源)。
在线演示
无稳定公共演示源,本页不内嵌在线预览
MVT 图层需要一个矢量瓦片服务({z}/{x}/{y}.pbf 模板)。公共 MVT 演示端点(如 OpenStreetMap / MapTiler)普遍需要 API Key 或不保证可用性,故本页不放在线预览;把下方配置里的 mvt-url 与 mvt-source-layer(瓦片内的 source-layer 名,必填)换成你的服务即可在编辑器中出图。
完整字段级配置(键名与属性面板一致):
{
"type": "map-mvt",
"uid": "ly_mvt",
"enabled": true,
"options": {
"mvt-url": "https://your-server/tiles/{z}/{x}/{y}.pbf",
"mvt-source-layer": "buildings",
"mvt-min-zoom": 0,
"mvt-max-zoom": 22,
"mvt-fill-color": "#2f6fb0",
"mvt-fill-opacity": 40,
"mvt-line-color": "#3aa1ff",
"mvt-line-width": 1.5,
"mvt-point-color": "#f5a623",
"mvt-point-radius": 4
}
}属性
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
mvt-url | 瓦片地址 | string | — | |
mvt-source-layer | 源图层名 | string | — | |
mvt-min-zoom | 最小级别 | number(min=0,max=24) | 0 | |
mvt-max-zoom | 最大级别 | number(min=0,max=24) | 22 | |
mvt-fill-color | 面填充 | color | #2f6fb0 | |
mvt-fill-opacity | 面不透明度 | slider(min=0,max=100,step=1,unit=%) | 40 | |
mvt-line-color | 线颜色 | color | #3aa1ff | |
mvt-line-width | 线宽 | number(unit=px,min=0,step=0.5) | 1.5 | |
mvt-point-color | 点颜色 | color | #f5a623 | |
mvt-point-radius | 点半径 | number(unit=px,min=1) | 4 | |
row-row-filter-mode-id | 选择数据规则 | select(condition) | — |
事件
| 触发器 | 名称 | 配在哪 | payload |
|---|---|---|---|
marker-click | 点击点要素 | map-2d 组件的 options.interactions(运行态按命中图层分流) | 命中要素属性行,公式 {:name} / {:value} 取值 |
region-click | 点击面要素 | 同上 | 同上 |
map-select / map-unselect | 选中 / 取消 | 同上 | 选中项数据 |
事件写在地图组件上而非图层上。图层还支持
feature-panel-uid(点击要素弹锚定窗口)与tooltip-enable(悬停浮层),见属性表。动作端可用mapLayerVisible/mapSetLayerStyle/mapRefreshData等 17 个地图动作,见 2D 地图 · 事件。
示例
{
"type": "map-mvt",
"uid": "ly_x",
"enabled": true,
"options": {
"mvt-url": "https://your-server/tiles/{z}/{x}/{y}.pbf",
"mvt-source-layer": "layerName"
}
}