MapboxWmsLayer
接入标准 WMS 服务为栅格图层,透传版本、格式、CRS 等参数。
简介
MapboxWmsLayer 把标准 WMS(GetMap)服务接入为栅格图层:url 与 layers 必填,version / format / crs / transparent 等透传,params 追加自定义查询参数。瓦片按 {bbox-epsg-3857} 逐块请求。
用法
接入 terrestris 公开 OSM-WMS:
<template>
<div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
<MapboxMap
:options="{ style: 'mapbox://styles/mapbox/light-v11', center: [10.45, 51.16], zoom: 5 }"
>
<!-- terrestris 公开 OSM-WMS(EPSG:3857) -->
<MapboxWmsLayer
url="https://ows.terrestris.de/osm/service"
layers="OSM-WMS"
attribution="© terrestris / OpenStreetMap"
/>
</MapboxMap>
</div>
</template>
API
Props
| Prop | Default | Type |
|---|---|---|
url | stringWMS 服务基础地址 | |
layers | string图层 LAYERS(逗号分隔多层) | |
layerId | `wms-${layers}` | stringsource/layer id |
version | '1.1.1' | stringWMS 版本 |
format | 'image/png' | string图片格式 |
styles | '' | string样式 |
crs | 'EPSG:3857' | string坐标参考系 |
tileSize | 256 | number瓦片尺寸 |
attribution | string版权信息 | |
params | Record<string, string>透传查询参数 | |
beforeId | string插入到该图层之前 | |
transparent | true | boolean是否透明 |
Changelog
No recent changes