GeoJSON map-geojson
2026年7月20日大约 4 分钟
GeoJSON map-geojson
综合点线面 GeoJSON 图层。
放在
map-2d的pieces里;enabled写在节点顶层。数据来源data-input:bind-fields(绑工程连接)或source(引用数据源)。
在线演示
预览使用内置公开演示服务 / 互联网底图,联网即可出图;可拖拽缩放。数据来自内联 GeoJSON 演示源。
属性
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
enable-zoom | 限制缩放区间 | boolean | false | |
min-zoom | 最小级别 | number(min=0,max=24,step=0.1) | 0 | |
max-zoom | 最大级别 | number(min=0,max=24,step=0.1) | 24 | |
circle-blur | 模糊 | slider(min=0,max=100,step=1,unit=%) | 0 | |
circle-stroke-opacity | 描边不透明度 | slider(min=0,max=100,step=1,unit=%) | 100 | |
circle-translate | 平移(px) | string | — | |
circle-translate-anchor | 平移参考 | select | map | 可选:map / viewport |
circle-pitch-scale | 倾斜时缩放 | select | map | 可选:map / viewport |
circle-pitch-alignment | 倾斜时对齐 | select | viewport | 可选:map / viewport |
line-dasharray | 虚线 | string | — | |
line-gap-width | 双线间隙 | number(unit=px,min=0) | 0 | |
line-offset | 偏移 | number(unit=px) | 0 | |
line-blur | 模糊 | number(unit=px,min=0) | 0 | |
line-cap | 线帽形状 | select | — | 可选:`` / butt / round / square |
line-join | 拐角形状 | select | — | 可选:`` / miter / round / bevel |
line-translate | 平移(px) | string | — | |
line-translate-anchor | 平移参考 | select | map | 可选:map / viewport |
line-pattern | 线图案 | map-icon | — | |
fill-antialias | 抗锯齿 | boolean | true | |
fill-pattern | 填充图案 | map-icon | — | |
fill-translate | 平移(px) | string | — | |
fill-translate-anchor | 平移参考 | select | map | 可选:map / viewport |
fill-color-mode | 填充色·取值 | select(radioGroup) | const | 可选:const / field / zoom |
fill-color-field | 填充色·字段 | string | — | |
fill-color-stops | 填充色·映射 | string(textarea,rows=3) | — | |
fill-opacity-mode | 填充不透明度·取值 | select(radioGroup) | const | 可选:const / field / zoom |
fill-opacity-field | 填充不透明度·字段 | string | — | |
fill-opacity-stops | 填充不透明度·映射 | string(textarea,rows=3) | — | |
line-color-mode | 线颜色·取值 | select(radioGroup) | const | 可选:const / field / zoom |
line-color-field | 线颜色·字段 | string | — | |
line-color-stops | 线颜色·映射 | string(textarea,rows=3) | — | |
line-width-mode | 线宽·取值 | select(radioGroup) | const | 可选:const / field / zoom |
line-width-field | 线宽·字段 | string | — | |
line-width-stops | 线宽·映射 | string(textarea,rows=3) | — | |
point-color-mode | 点颜色·取值 | select(radioGroup) | const | 可选:const / field / zoom |
point-color-field | 点颜色·字段 | string | — | |
point-color-stops | 点颜色·映射 | string(textarea,rows=3) | — | |
point-radius-mode | 点半径·取值 | select(radioGroup) | const | 可选:const / field / zoom |
point-radius-field | 点半径·字段 | string | — | |
point-radius-stops | 点半径·映射 | string(textarea,rows=3) | — | |
fill-color | 填充色 | color | #2f6fb0 | |
fill-opacity | 填充不透明度 | slider(min=0,max=100,step=1,unit=%) | 45 | |
line-color | 线颜色 | color | #3aa1ff | |
line-width | 线宽 | number(unit=px,min=0,step=0.5) | 2 | |
point-color | 点颜色 | color | #f5a623 | |
point-radius | 点半径 | number(unit=px,min=1) | 5 | |
point-stroke-width | 描边宽度 | number(unit=px,min=0,step=0.5) | 1 | |
geo-hover-color | 悬停颜色 | color | #3aa1ff | |
geo-selected-color | 选中颜色 | color | #ff7875 | |
geojson-url | GeoJSON 地址 | string | — | |
geojson-text | 或粘贴 GeoJSON | json(height=220px) | { "type": "FeatureCollection", "features": [ { … | |
row-row-filter-mode-id | 选择数据规则 | select(condition) | — | |
filter-expr | 过滤条件 | string(textarea,rows=4) | — | |
filter-combine | 组合方式 | select(radioGroup) | all | 可选:all / any |
tooltip-enable | 启用悬停提示 | boolean | false | |
tooltip-fields | 显示字段 | string | — | |
tooltip-title-field | 标题字段 | string | — | |
feature-panel-uid | 点击弹出画面 | window | [] | |
feature-panel-offset | 弹窗偏移(px) | vector<水平,垂直> | [0,0] | |
data-input | 来源方式 | select(radioGroup) | bind-fields | 可选:bind-fields / source |
data-source-uid | 选择数据源 | map-source | [] |
事件
| 触发器 | 名称 | 配在哪 | 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-geojson",
"uid": "ly_x",
"enabled": true,
"options": {
"data-input": "source",
"data-source-uid": [{ "refType": "element", "targetPath": ["src_x"] }]
}
}