Skip to content

使用 WMS 数据源≥0.11.5

loading

V0.11.5 增加了 WMS 数据源支持,可以使用 WMS 地图服务:

ts
// 1. 定义wms地图服务数据源
const wmsSource = new plugin.WmsSource({
    url: "https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?&service=WMS&request=GetMap&layers=nexrad-n0r-wmst&styles=&format=image/png&transparent=true&version=1.1.1&time=2005-08-29T14:00&width=256&height=256&srs=EPSG:3857&bbox={bbox}",
});

// 创建地图
const map = tt.TileMap.create({
    // 使用wms服务数据源
    imgSource: [new plugin.ArcGisSource(), wmsSource],
    // 地形数据源
    demSource: new plugin.ArcGisDemSource(),
    // 中央经线设为美洲
    lon0: -90,
});

TIP

也可以直接使用 TileSource.create 方法创建 WMS 数据源,数据源的 url 中需要包含 {bbox} 占位符。

Released under the MIT License.