This module is now deprecated in favor of using the turf-union
module
repeatedly on an array.
merge polygons
Takes a set of Polygon|polygons and returns a single merged polygon feature. If the input polygon features are not contiguous, this function returns a MultiPolygon feature.
parameter | type | description |
---|---|---|
fc |
FeatureCollection.<Polygon> | input polygons |
var polygons = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"fill": "#0f0"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[9.994812, 53.549487],
[10.046997, 53.598209],
[10.117721, 53.531737],
[9.994812, 53.549487]
]]
}
}, {
"type": "Feature",
"properties": {
"fill": "#00f"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[10.000991, 53.50418],
[10.03807, 53.562539],
[9.926834, 53.551731],
[10.000991, 53.50418]
]]
}
}
]
};
var merged = turf.merge(polygons);
//=polygons
//=merged
Returns Feature.<Polygon|MultiPolygon>
, merged polygon or multipolygon
Requires nodejs.
$ npm install turf-merge
$ npm test