山体阴影 map-hillshade
2026年7月20日大约 2 分钟
山体阴影 map-hillshade
地形山体阴影图层。
放在
map-2d的pieces里;enabled写在节点顶层。数据来源data-input:bind-fields(绑工程连接)或source(引用数据源)。
在线演示
无稳定公共演示源,本页不内嵌在线预览
山体阴影需要 raster-dem 高程瓦片服务(terrain-rgb 或 terrarium 编码,且需地理坐标底图 + 跨域可访问)。公共 DEM 演示端点不稳定,故本页不放在线预览;把下方配置里的 dem-url 换成你的高程服务(并按服务选对 dem-encoding)即可在编辑器中出图。
完整字段级配置(键名与属性面板一致):
{
"type": "map-hillshade",
"uid": "ly_hill",
"enabled": true,
"options": {
"dem-url": "https://your-server/dem/{z}/{x}/{y}.png",
"dem-encoding": "terrarium",
"dem-tile-size": 512,
"dem-maxzoom": 14,
"hillshade-exaggeration": 50,
"hillshade-direction": 335,
"hillshade-shadow-color": "#000000",
"hillshade-highlight-color": "#ffffff",
"hillshade-accent-color": "#000000"
}
}属性
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
dem-url | DEM 瓦片地址 | string | — | |
dem-encoding | 高程编码 | select | mapbox | 可选:mapbox / terrarium |
dem-tile-size | 瓦片尺寸 | select | 512 | 可选:256 / 512 |
dem-maxzoom | 最大级 | number(min=0,max=24) | 14 | |
hillshade-exaggeration | 夸张程度 | slider(min=0,max=100,step=1,unit=%) | 50 | |
hillshade-direction | 光照方向 | slider(min=0,max=359,step=1,unit=°) | 335 | |
hillshade-shadow-color | 阴影色 | color | #000000 | |
hillshade-highlight-color | 高光色 | color | #ffffff | |
hillshade-accent-color | 强调色 | color | #000000 | |
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-hillshade",
"uid": "ly_x",
"enabled": true,
"options": {
"dem-url": "https://your-server/dem/{z}/{x}/{y}.png",
"dem-encoding": "terrarium"
}
}