@turf/buffer 7.0.0-alpha.0 → 7.0.0-alpha.2
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/dist/es/index.js +3 -1
- package/dist/js/index.js +6 -3
- package/package.json +13 -11
package/dist/es/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import center from '@turf/center';
|
|
2
|
-
import
|
|
2
|
+
import jsts from '@turf/jsts';
|
|
3
3
|
import { featureEach, geomEach } from '@turf/meta';
|
|
4
4
|
import { geoAzimuthalEquidistant } from 'd3-geo';
|
|
5
5
|
import { featureCollection, earthRadius, radiansToLength, lengthToRadians, feature } from '@turf/helpers';
|
|
6
6
|
|
|
7
|
+
const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts;
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
|
|
9
11
|
*
|
package/dist/js/index.js
CHANGED
|
@@ -9,6 +9,9 @@ var helpers = require('@turf/helpers');
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
11
11
|
var center__default = /*#__PURE__*/_interopDefaultLegacy(center);
|
|
12
|
+
var jsts__default = /*#__PURE__*/_interopDefaultLegacy(jsts);
|
|
13
|
+
|
|
14
|
+
const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts__default['default'];
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
|
|
@@ -104,11 +107,11 @@ function bufferFeature(geojson, radius, units, steps) {
|
|
|
104
107
|
};
|
|
105
108
|
|
|
106
109
|
// JSTS buffer operation
|
|
107
|
-
var reader = new
|
|
110
|
+
var reader = new GeoJSONReader();
|
|
108
111
|
var geom = reader.read(projected);
|
|
109
112
|
var distance = helpers.radiansToLength(helpers.lengthToRadians(radius, units), "meters");
|
|
110
|
-
var buffered =
|
|
111
|
-
var writer = new
|
|
113
|
+
var buffered = BufferOp.bufferOp(geom, distance, steps);
|
|
114
|
+
var writer = new GeoJSONWriter();
|
|
112
115
|
buffered = writer.write(buffered);
|
|
113
116
|
|
|
114
117
|
// Detect if empty geometries
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/buffer",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.2",
|
|
4
4
|
"description": "turf buffer module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"exports": {
|
|
36
36
|
"./package.json": "./package.json",
|
|
37
37
|
".": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
38
39
|
"import": "./dist/es/index.js",
|
|
39
40
|
"require": "./dist/js/index.js"
|
|
40
41
|
}
|
|
@@ -46,30 +47,31 @@
|
|
|
46
47
|
"index.d.ts"
|
|
47
48
|
],
|
|
48
49
|
"scripts": {
|
|
49
|
-
"bench": "
|
|
50
|
+
"bench": "tsx bench.js",
|
|
50
51
|
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
51
|
-
"docs": "
|
|
52
|
+
"docs": "tsx ../../scripts/generate-readmes",
|
|
52
53
|
"test": "npm-run-all test:*",
|
|
53
|
-
"test:tape": "
|
|
54
|
+
"test:tape": "tsx test.js",
|
|
54
55
|
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@turf/truncate": "^7.0.0-alpha.
|
|
58
|
+
"@turf/truncate": "^7.0.0-alpha.2",
|
|
58
59
|
"benchmark": "*",
|
|
59
60
|
"load-json-file": "*",
|
|
60
61
|
"npm-run-all": "*",
|
|
61
62
|
"rollup": "*",
|
|
62
63
|
"tape": "*",
|
|
64
|
+
"tsx": "*",
|
|
63
65
|
"write-json-file": "*"
|
|
64
66
|
},
|
|
65
67
|
"dependencies": {
|
|
66
|
-
"@turf/bbox": "^7.0.0-alpha.
|
|
67
|
-
"@turf/center": "^7.0.0-alpha.
|
|
68
|
-
"@turf/helpers": "^7.0.0-alpha.
|
|
68
|
+
"@turf/bbox": "^7.0.0-alpha.2",
|
|
69
|
+
"@turf/center": "^7.0.0-alpha.2",
|
|
70
|
+
"@turf/helpers": "^7.0.0-alpha.2",
|
|
69
71
|
"@turf/jsts": "^2.7.1",
|
|
70
|
-
"@turf/meta": "^7.0.0-alpha.
|
|
71
|
-
"@turf/projection": "^7.0.0-alpha.
|
|
72
|
+
"@turf/meta": "^7.0.0-alpha.2",
|
|
73
|
+
"@turf/projection": "^7.0.0-alpha.2",
|
|
72
74
|
"d3-geo": "1.7.1"
|
|
73
75
|
},
|
|
74
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "dd35b52725945b4fa29a98d9a550733e06cc222e"
|
|
75
77
|
}
|