leaflet-clippedwms
TypeScript icon, indicating that this package has built-in type declarations

0.5.3 • Public • Published

leaflet-clippedWms

leaflet-clippedWms 用于加载一个『裁剪』过的 wms 图层。

裁剪:对于一个图层,给定一个多边形区域,只保留区域内部分。

使用

ClippedWMS 继承自 L.TileLayer.WMS,使用方法与它完全相同,只是额外加入了 clip 参数,用于传入所需裁剪的区域。

  • clip 参数的值是一个 geojson geometry 对象,类型必须为 Polygon 或 MultiPolygon。
  • 如果不传入 clip(或者为 null),图层将不会被裁剪。

示例

// 裁剪区域
const geometry = {
  type: 'Polygon',
  coordinates: [
    [
      [125.90806629, 46.83817821],
      [125.89487407, 46.82173077],
      [125.91543337, 46.80596864],
      [125.97282808, 46.79757359],
      [125.9829364, 46.82532865],
      [125.90806629, 46.83817821],
    ],
  ],
};

clippedWMS('http://geoserversh.nydsju.com/geoserver/sample/wms', {
  layers: 'integration_space:growth_qinggang_202208',
  format: 'image/png',
  transparent: true,
  version: '1.1.0',
  crs: L.CRS.EPSG4326,
  clip: geometry, // 唯一额外添加的参数
}).addTo(this.map);

Package Sidebar

Install

npm i leaflet-clippedwms

Weekly Downloads

1

Version

0.5.3

License

MIT

Unpacked Size

24 kB

Total Files

27

Last publish

Collaborators

  • naglfarrr