@turf/buffer 6.5.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 CHANGED
@@ -12,15 +12,16 @@ FeatureCollection, only valid members will be returned in the output
12
12
  FeatureCollection - i.e., the output collection may have fewer members than
13
13
  the input, or even be empty.
14
14
 
15
- **Parameters**
15
+ ### Parameters
16
16
 
17
- - `geojson` **([FeatureCollection][1] \| [Geometry][2] \| [Feature][3]<any>)** input to be buffered
18
- - `radius` **[number][4]** distance to draw the buffer (negative values are allowed)
19
- - `options` **[Object][5]** Optional parameters (optional, default `{}`)
20
- - `options.units` **[string][6]** any of the options supported by turf units (optional, default `"kilometers"`)
21
- - `options.steps` **[number][4]** number of steps (optional, default `8`)
17
+ * `geojson` **([FeatureCollection][1] | [Geometry][2] | [Feature][3]\<any>)** input to be buffered
18
+ * `radius` **[number][4]** distance to draw the buffer (negative values are allowed)
19
+ * `options` **[Object][5]** Optional parameters (optional, default `{}`)
22
20
 
23
- **Examples**
21
+ * `options.units` **[string][6]** any of the options supported by turf units (optional, default `"kilometers"`)
22
+ * `options.steps` **[number][4]** number of steps (optional, default `8`)
23
+
24
+ ### Examples
24
25
 
25
26
  ```javascript
26
27
  var point = turf.point([-90.548630, 14.616599]);
@@ -30,7 +31,7 @@ var buffered = turf.buffer(point, 500, {units: 'miles'});
30
31
  var addToMap = [point, buffered]
31
32
  ```
32
33
 
33
- Returns **([FeatureCollection][1] \| [Feature][3]&lt;([Polygon][7] \| [MultiPolygon][8])> | [undefined][9])** buffered features
34
+ Returns **([FeatureCollection][1] | [Feature][3]<([Polygon][7] | [MultiPolygon][8])> | [undefined][9])** buffered features
34
35
 
35
36
  [1]: https://tools.ietf.org/html/rfc7946#section-3.3
36
37
 
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import center from '@turf/center';
2
- import { GeoJSONReader, BufferOp, GeoJSONWriter } from 'turf-jsts';
2
+ import { GeoJSONReader, BufferOp, GeoJSONWriter } 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';
package/dist/js/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var center = require('@turf/center');
4
- var turfJsts = require('turf-jsts');
4
+ var jsts = require('@turf/jsts');
5
5
  var meta = require('@turf/meta');
6
6
  var d3Geo = require('d3-geo');
7
7
  var helpers = require('@turf/helpers');
@@ -104,11 +104,11 @@ function bufferFeature(geojson, radius, units, steps) {
104
104
  };
105
105
 
106
106
  // JSTS buffer operation
107
- var reader = new turfJsts.GeoJSONReader();
107
+ var reader = new jsts.GeoJSONReader();
108
108
  var geom = reader.read(projected);
109
109
  var distance = helpers.radiansToLength(helpers.lengthToRadians(radius, units), "meters");
110
- var buffered = turfJsts.BufferOp.bufferOp(geom, distance, steps);
111
- var writer = new turfJsts.GeoJSONWriter();
110
+ var buffered = jsts.BufferOp.bufferOp(geom, distance, steps);
111
+ var writer = new jsts.GeoJSONWriter();
112
112
  buffered = writer.write(buffered);
113
113
 
114
114
  // Detect if empty geometries
package/index.d.ts CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  GeometryCollection,
10
10
  Feature,
11
11
  FeatureCollection,
12
- Units,
13
- } from "@turf/helpers";
12
+ } from "geojson";
13
+ import { Units } from "@turf/helpers";
14
14
 
15
15
  interface Options {
16
16
  units?: Units;
@@ -20,42 +20,22 @@ interface Options {
20
20
  /**
21
21
  * http://turfjs.org/docs/#buffer
22
22
  */
23
- declare function buffer<Geom extends Point | LineString | Polygon>(
24
- feature: Feature<Geom> | Geom,
25
- radius?: number,
26
- options?: Options
27
- ): Feature<Polygon>;
28
- declare function buffer<
29
- Geom extends MultiPoint | MultiLineString | MultiPolygon
30
- >(
31
- feature: Feature<Geom> | Geom,
32
- radius?: number,
33
- options?: Options
34
- ): Feature<MultiPolygon>;
35
- declare function buffer<Geom extends Point | LineString | Polygon>(
36
- feature: FeatureCollection<Geom>,
37
- radius?: number,
38
- options?: Options
39
- ): FeatureCollection<Polygon>;
40
- declare function buffer<
41
- Geom extends MultiPoint | MultiLineString | MultiPolygon
42
- >(
43
- feature: FeatureCollection<Geom>,
44
- radius?: number,
45
- options?: Options
46
- ): FeatureCollection<MultiPolygon>;
47
23
  declare function buffer(
48
24
  feature:
49
- | FeatureCollection<any>
50
- | Feature<GeometryCollection>
51
- | GeometryCollection,
25
+ | Feature<GeometryObject>
26
+ | Point
27
+ | LineString
28
+ | Polygon
29
+ | MultiPoint
30
+ | MultiLineString
31
+ | MultiPolygon,
52
32
  radius?: number,
53
33
  options?: Options
54
- ): FeatureCollection<Polygon | MultiPolygon>;
34
+ ): Feature<Polygon | MultiPolygon>;
55
35
  declare function buffer(
56
- feature: Feature<any> | GeometryObject,
36
+ feature: FeatureCollection<GeometryObject> | GeometryCollection,
57
37
  radius?: number,
58
38
  options?: Options
59
- ): Feature<Polygon | MultiPolygon>;
39
+ ): FeatureCollection<Polygon | MultiPolygon>;
60
40
 
61
41
  export default buffer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/buffer",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf buffer module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -51,10 +51,10 @@
51
51
  "docs": "node ../../scripts/generate-readmes",
52
52
  "test": "npm-run-all test:*",
53
53
  "test:tape": "node -r esm test.js",
54
- "test:types": "tsc --esModuleInterop --noEmit types.ts"
54
+ "test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
55
55
  },
56
56
  "devDependencies": {
57
- "@turf/truncate": "^6.5.0",
57
+ "@turf/truncate": "^7.0.0-alpha.0",
58
58
  "benchmark": "*",
59
59
  "load-json-file": "*",
60
60
  "npm-run-all": "*",
@@ -63,13 +63,13 @@
63
63
  "write-json-file": "*"
64
64
  },
65
65
  "dependencies": {
66
- "@turf/bbox": "^6.5.0",
67
- "@turf/center": "^6.5.0",
68
- "@turf/helpers": "^6.5.0",
69
- "@turf/meta": "^6.5.0",
70
- "@turf/projection": "^6.5.0",
71
- "d3-geo": "1.7.1",
72
- "turf-jsts": "*"
66
+ "@turf/bbox": "^7.0.0-alpha.0",
67
+ "@turf/center": "^7.0.0-alpha.0",
68
+ "@turf/helpers": "^7.0.0-alpha.0",
69
+ "@turf/jsts": "^2.7.1",
70
+ "@turf/meta": "^7.0.0-alpha.0",
71
+ "@turf/projection": "^7.0.0-alpha.0",
72
+ "d3-geo": "1.7.1"
73
73
  },
74
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
74
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
75
75
  }