MapboxWmsLayer

View source
接入标准 WMS 服务为栅格图层,透传版本、格式、CRS 等参数。

简介

MapboxWmsLayer 把标准 WMS(GetMap)服务接入为栅格图层:urllayers 必填,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
urlstring

WMS 服务基础地址

layersstring

图层 LAYERS(逗号分隔多层)

layerId`wms-${layers}`string

source/layer id

version'1.1.1'string

WMS 版本

format'image/png'string

图片格式

styles''string

样式

crs'EPSG:3857'string

坐标参考系

tileSize256number

瓦片尺寸

attributionstring

版权信息

paramsRecord<string, string>

透传查询参数

beforeIdstring

插入到该图层之前

transparenttrueboolean

是否透明

Changelog

No recent changes
Copyright © 2026 - 2026 YiXuan - MIT License