@turf/simplify 6.4.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +10 -6
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
Takes a [GeoJSON][1] object and returns a simplified version. Internally uses
|
|
8
8
|
[simplify-js][2] to perform simplification using the Ramer-Douglas-Peucker algorithm.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `options.tolerance` **[number][5]** simplification tolerance (optional, default `1`)
|
|
15
|
-
- `options.highQuality` **[boolean][6]** whether or not to spend more time to create a higher-quality simplification with a different algorithm (optional, default `false`)
|
|
16
|
-
- `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
12
|
+
* `geojson` **[GeoJSON][3]** object to be simplified
|
|
13
|
+
* `options` **[Object][4]** Optional parameters (optional, default `{}`)
|
|
17
14
|
|
|
18
|
-
**
|
|
15
|
+
* `options.tolerance` **[number][5]** simplification tolerance (optional, default `1`)
|
|
16
|
+
* `options.highQuality` **[boolean][6]** whether or not to spend more time to create a higher-quality simplification with a different algorithm (optional, default `false`)
|
|
17
|
+
* `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
18
|
+
|
|
19
|
+
### Examples
|
|
19
20
|
|
|
20
21
|
```javascript
|
|
21
22
|
var geojson = turf.polygon([[
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var cleanCoords = _interopDefault(require('@turf/clean-coords'));
|
|
6
|
-
var clone = _interopDefault(require('@turf/clone'));
|
|
3
|
+
var cleanCoords = require('@turf/clean-coords');
|
|
4
|
+
var clone = require('@turf/clone');
|
|
7
5
|
var meta = require('@turf/meta');
|
|
8
6
|
var helpers = require('@turf/helpers');
|
|
9
7
|
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var cleanCoords__default = /*#__PURE__*/_interopDefaultLegacy(cleanCoords);
|
|
11
|
+
var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
|
|
12
|
+
|
|
10
13
|
/*
|
|
11
14
|
(c) 2013, Vladimir Agafonkin
|
|
12
15
|
Simplify.js, a high-performance JS polyline simplification library
|
|
@@ -167,7 +170,7 @@ function simplify$1(geojson, options) {
|
|
|
167
170
|
if (tolerance && tolerance < 0) throw new Error("invalid tolerance");
|
|
168
171
|
|
|
169
172
|
// Clone geojson to avoid side effects
|
|
170
|
-
if (mutate !== true) geojson =
|
|
173
|
+
if (mutate !== true) geojson = clone__default['default'](geojson);
|
|
171
174
|
|
|
172
175
|
meta.geomEach(geojson, function (geom) {
|
|
173
176
|
simplifyGeom(geom, tolerance, highQuality);
|
|
@@ -191,7 +194,7 @@ function simplifyGeom(geometry, tolerance, highQuality) {
|
|
|
191
194
|
if (type === "Point" || type === "MultiPoint") return geometry;
|
|
192
195
|
|
|
193
196
|
// Remove any extra coordinates
|
|
194
|
-
|
|
197
|
+
cleanCoords__default['default'](geometry, true);
|
|
195
198
|
|
|
196
199
|
var coordinates = geometry.coordinates;
|
|
197
200
|
switch (type) {
|
|
@@ -302,3 +305,4 @@ function checkValidity(ring) {
|
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
module.exports = simplify$1;
|
|
308
|
+
module.exports.default = simplify$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/simplify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf simplify module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git://github.com/Turfjs/turf.git"
|
|
18
18
|
},
|
|
19
|
+
"funding": "https://opencollective.com/turf",
|
|
19
20
|
"publishConfig": {
|
|
20
21
|
"access": "public"
|
|
21
22
|
},
|
|
@@ -48,10 +49,10 @@
|
|
|
48
49
|
"docs": "node ../../scripts/generate-readmes",
|
|
49
50
|
"test": "npm-run-all test:*",
|
|
50
51
|
"test:tape": "node -r esm test.js",
|
|
51
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
52
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@turf/truncate": "^
|
|
55
|
+
"@turf/truncate": "^7.0.0-alpha.0",
|
|
55
56
|
"benchmark": "*",
|
|
56
57
|
"load-json-file": "*",
|
|
57
58
|
"npm-run-all": "*",
|
|
@@ -60,10 +61,10 @@
|
|
|
60
61
|
"write-json-file": "*"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@turf/clean-coords": "^
|
|
64
|
-
"@turf/clone": "^
|
|
65
|
-
"@turf/helpers": "^
|
|
66
|
-
"@turf/meta": "^
|
|
64
|
+
"@turf/clean-coords": "^7.0.0-alpha.0",
|
|
65
|
+
"@turf/clone": "^7.0.0-alpha.0",
|
|
66
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
67
|
+
"@turf/meta": "^7.0.0-alpha.0"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
69
70
|
}
|