Skip to content

描述 ​

溶解 Polygon 要素的 FeatureCollection,可选按属性名:值过滤。 注意:集合中的 MultiPolygon 要素不受支持

参数 ​

名称类型描述
fcFeatureCollection<Polygon>
options?Object可选参数 (默认 {})
options.propertyName?string具有相同 propertyName 值的要素将被溶解。
featureCollectionFeatureCollection<Polygon>待溶解的输入要素集合

返回值 ​

FeatureCollection<Polygon> 包含溶解后多边形的 FeatureCollection

示例 ​

javascript
var features = turf.featureCollection([
  turf.polygon(
    [
      [
        [0, 0],
        [0, 1],
        [1, 1],
        [1, 0],
        [0, 0],
      ],
    ],
    { combine: "yes" },
  ),
  turf.polygon(
    [
      [
        [0, -1],
        [0, 0],
        [1, 0],
        [1, -1],
        [0, -1],
      ],
    ],
    { combine: "yes" },
  ),
  turf.polygon(
    [
      [
        [1, -1],
        [1, 0],
        [2, 0],
        [2, -1],
        [1, -1],
      ],
    ],
    { combine: "no" },
  ),
]);

var dissolved = turf.dissolve(features, { propertyName: "combine" });

安装 ​

javascript
$ npm install @turf/dissolve

import { dissolve } from "@turf/dissolve";
const result = dissolve(...);
javascript
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.dissolve(...);