学習内容: Web Map Service (WMS) を利用して地理空間データを地図上に表示します。
ポイント:
注意:
WMS (Web Map Service) は、OGC (Open Geospatial Consortium) が策定した地理情報を提供するための標準プロトコルです。
// WMSレイヤーの基本的な使い方
const wmsLayer = L.tileLayer.wms('https://example.com/wms', {
layers: 'layer_name', // 表示するレイヤー
format: 'image/png', // 画像フォーマット
transparent: true, // 背景透過
version: '1.1.1', // WMSバージョン
attribution: 'Data source'
}).addTo(map);
// 複数レイヤーを表示
const multiLayer = L.tileLayer.wms('https://example.com/wms', {
layers: 'layer1,layer2', // カンマ区切りで複数指定
styles: 'style1,style2' // 各レイヤーのスタイル
});
// パラメータの動的変更
wmsLayer.setParams({ layers: 'new_layer' });