@turf/dissolve
Advanced tools
Comparing version 7.1.0 to 7.2.0
import { FeatureCollection, Polygon } from 'geojson'; | ||
/** | ||
* Dissolves a FeatureCollection of {@link polygon} features, filtered by an optional property name:value. | ||
* Note that {@link mulitpolygon} features within the collection are not supported | ||
* Dissolves a FeatureCollection of {@link Polygon} features, filtered by an optional property name:value. | ||
* Note that {@link MultiPolygon} features within the collection are not supported | ||
* | ||
* @name dissolve | ||
* @function | ||
* @param {FeatureCollection<Polygon>} featureCollection input feature collection to be dissolved | ||
@@ -9,0 +9,0 @@ * @param {Object} [options={}] Optional parameters |
@@ -6,7 +6,6 @@ // index.ts | ||
import { flatten } from "@turf/flatten"; | ||
import polygonClipping from "polygon-clipping"; | ||
import * as polyclip from "polyclip-ts"; | ||
function dissolve(fc, options = {}) { | ||
options = options || {}; | ||
if (!isObject(options)) | ||
throw new Error("options is invalid"); | ||
if (!isObject(options)) throw new Error("options is invalid"); | ||
const { propertyName } = options; | ||
@@ -18,3 +17,3 @@ collectionOf(fc, "Polygon", "dissolve"); | ||
multiPolygon( | ||
polygonClipping.union.apply( | ||
polyclip.union.apply( | ||
null, | ||
@@ -44,3 +43,3 @@ // List of polygons expressed as Position[][][] a.k.a. Geom[] | ||
const mp = multiPolygon( | ||
polygonClipping.union.apply( | ||
polyclip.union.apply( | ||
null, | ||
@@ -47,0 +46,0 @@ // List of polygons expressed as Position[][][] a.k.a. Geom[] |
{ | ||
"name": "@turf/dissolve", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "turf dissolve module", | ||
@@ -56,22 +56,22 @@ "author": "Turf Authors", | ||
"@types/benchmark": "^2.1.5", | ||
"@types/tape": "^4.2.32", | ||
"@types/tape": "^4.13.4", | ||
"benchmark": "^2.1.4", | ||
"load-json-file": "^7.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"tape": "^5.7.2", | ||
"tsup": "^8.0.1", | ||
"tsx": "^4.6.2", | ||
"typescript": "^5.2.2", | ||
"tape": "^5.9.0", | ||
"tsup": "^8.3.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.5.4", | ||
"write-json-file": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@turf/flatten": "^7.1.0", | ||
"@turf/helpers": "^7.1.0", | ||
"@turf/invariant": "^7.1.0", | ||
"@turf/meta": "^7.1.0", | ||
"@turf/flatten": "^7.2.0", | ||
"@turf/helpers": "^7.2.0", | ||
"@turf/invariant": "^7.2.0", | ||
"@turf/meta": "^7.2.0", | ||
"@types/geojson": "^7946.0.10", | ||
"polygon-clipping": "^0.15.3", | ||
"tslib": "^2.6.2" | ||
"polyclip-ts": "^0.16.8", | ||
"tslib": "^2.8.1" | ||
}, | ||
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef" | ||
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867" | ||
} |
@@ -7,11 +7,12 @@ # @turf/dissolve | ||
Dissolves a FeatureCollection of [polygon][1] features, filtered by an optional property name:value. | ||
Note that [mulitpolygon][2] features within the collection are not supported | ||
Dissolves a FeatureCollection of [Polygon][1] features, filtered by an optional property name:value. | ||
Note that [MultiPolygon][2] features within the collection are not supported | ||
### Parameters | ||
* `featureCollection` **[FeatureCollection][3]<[Polygon][4]>** input feature collection to be dissolved | ||
* `options` **[Object][5]** Optional parameters (optional, default `{}`) | ||
* `fc` **[FeatureCollection][3]<[Polygon][1]>**  | ||
* `options` **[Object][4]** Optional parameters (optional, default `{}`) | ||
* `options.propertyName` **[string][6]?** features with the same `propertyName` value will be dissolved. | ||
* `options.propertyName` **[string][5]?** features with the same `propertyName` value will be dissolved. | ||
* `featureCollection` **[FeatureCollection][3]<[Polygon][1]>** input feature collection to be dissolved | ||
@@ -33,16 +34,14 @@ ### Examples | ||
Returns **[FeatureCollection][3]<[Polygon][4]>** a FeatureCollection containing the dissolved polygons | ||
Returns **[FeatureCollection][3]<[Polygon][1]>** a FeatureCollection containing the dissolved polygons | ||
[1]: polygon | ||
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6 | ||
[2]: mulitpolygon | ||
[2]: https://tools.ietf.org/html/rfc7946#section-3.1.7 | ||
[3]: https://tools.ietf.org/html/rfc7946#section-3.3 | ||
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6 | ||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String | ||
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. --> | ||
@@ -49,0 +48,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22240
146
64
+ Addedpolyclip-ts@^0.16.8
+ Addedbignumber.js@9.1.2(transitive)
+ Addedpolyclip-ts@0.16.8(transitive)
+ Addedsplaytree-ts@1.0.2(transitive)
- Removedpolygon-clipping@^0.15.3
- Removedpolygon-clipping@0.15.7(transitive)
- Removedrobust-predicates@3.0.2(transitive)
- Removedsplaytree@3.1.2(transitive)
Updated@turf/flatten@^7.2.0
Updated@turf/helpers@^7.2.0
Updated@turf/invariant@^7.2.0
Updated@turf/meta@^7.2.0
Updatedtslib@^2.8.1