@turf/circle 7.0.0 → 7.1.0-alpha.70
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 +12 -14
- package/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -8,13 +8,13 @@ Takes a [Point][1] and calculates the circle polygon given a radius in degrees,
|
|
|
8
8
|
|
|
9
9
|
### Parameters
|
|
10
10
|
|
|
11
|
-
* `center` **([Feature][2]<[Point][
|
|
12
|
-
* `radius` **[number][
|
|
13
|
-
* `options` **[Object][
|
|
11
|
+
* `center` **([Feature][2]<[Point][1]> | [Array][3]<[number][4]>)** center point
|
|
12
|
+
* `radius` **[number][4]** radius of the circle
|
|
13
|
+
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
|
|
14
14
|
|
|
15
|
-
* `options.steps` **[number][
|
|
16
|
-
* `options.units` **[string][
|
|
17
|
-
* `options.properties` **[Object][
|
|
15
|
+
* `options.steps` **[number][4]** number of steps (optional, default `64`)
|
|
16
|
+
* `options.units` **[string][6]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
|
|
17
|
+
* `options.properties` **[Object][5]** properties (optional, default `{}`)
|
|
18
18
|
|
|
19
19
|
### Examples
|
|
20
20
|
|
|
@@ -28,23 +28,21 @@ var circle = turf.circle(center, radius, options);
|
|
|
28
28
|
var addToMap = [turf.point(center), circle]
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Returns **[Feature][2]<[Polygon][
|
|
31
|
+
Returns **[Feature][2]<[Polygon][7]>** circle polygon
|
|
32
32
|
|
|
33
33
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
34
34
|
|
|
35
35
|
[2]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
36
36
|
|
|
37
|
-
[3]: https://
|
|
37
|
+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
38
38
|
|
|
39
|
-
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
39
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
40
40
|
|
|
41
|
-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
41
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
42
42
|
|
|
43
|
-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
43
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
44
44
|
|
|
45
|
-
[7]: https://
|
|
46
|
-
|
|
47
|
-
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
45
|
+
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
48
46
|
|
|
49
47
|
<!-- 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. -->
|
|
50
48
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
var _destination = require('@turf/destination');
|
|
6
3
|
var _helpers = require('@turf/helpers');
|
|
7
4
|
function circle(center, radius, options = {}) {
|
|
@@ -16,7 +13,6 @@ function circle(center, radius, options = {}) {
|
|
|
16
13
|
coordinates.push(coordinates[0]);
|
|
17
14
|
return _helpers.polygon.call(void 0, [coordinates], properties);
|
|
18
15
|
}
|
|
19
|
-
__name(circle, "circle");
|
|
20
16
|
var turf_circle_default = circle;
|
|
21
17
|
|
|
22
18
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,eAAsB;AAsB/B,SAAS,OACP,QACA,QACA,UAII,CAAC,GACgB;AAErB,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAkB,QAAQ,aAC5B,QAAQ,aACR,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,aAAa,OAAO,aAC5D,OAAO,aACP,CAAC;AAGP,QAAM,cAAc,CAAC;AACrB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,gBAAY;AAAA,MACV,YAAY,QAAQ,QAAS,IAAI,OAAQ,OAAO,OAAO,EAAE,SACtD;AAAA,IACL;AAAA,EACF;AACA,cAAY,KAAK,YAAY,CAAC,CAAC;AAE/B,SAAO,QAAQ,CAAC,WAAW,GAAG,UAAU;AAC1C;AAGA,IAAO,sBAAQ","sourcesContent":["import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.\n *\n * @name circle\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
import { destination } from "@turf/destination";
|
|
6
3
|
import { polygon } from "@turf/helpers";
|
|
@@ -16,7 +13,6 @@ function circle(center, radius, options = {}) {
|
|
|
16
13
|
coordinates.push(coordinates[0]);
|
|
17
14
|
return polygon([coordinates], properties);
|
|
18
15
|
}
|
|
19
|
-
__name(circle, "circle");
|
|
20
16
|
var turf_circle_default = circle;
|
|
21
17
|
export {
|
|
22
18
|
circle,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.\n *\n * @name circle\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.\n *\n * @name circle\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,eAAsB;AAsB/B,SAAS,OACP,QACA,QACA,UAII,CAAC,GACgB;AAErB,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAkB,QAAQ,aAC5B,QAAQ,aACR,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,aAAa,OAAO,aAC5D,OAAO,aACP,CAAC;AAGP,QAAM,cAAc,CAAC;AACrB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,gBAAY;AAAA,MACV,YAAY,QAAQ,QAAS,IAAI,OAAQ,OAAO,OAAO,EAAE,SACtD;AAAA,IACL;AAAA,EACF;AACA,cAAY,KAAK,YAAY,CAAC,CAAC;AAE/B,SAAO,QAAQ,CAAC,WAAW,GAAG,UAAU;AAC1C;AAGA,IAAO,sBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/circle",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf circle module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@placemarkio/check-geojson": "^0.1.12",
|
|
58
|
-
"@turf/truncate": "^7.0.
|
|
58
|
+
"@turf/truncate": "^7.1.0-alpha.70+948cdafaf",
|
|
59
59
|
"@types/benchmark": "^2.1.5",
|
|
60
60
|
"@types/tape": "^4.2.32",
|
|
61
61
|
"benchmark": "^2.1.4",
|
|
@@ -68,9 +68,10 @@
|
|
|
68
68
|
"write-json-file": "^5.0.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@turf/destination": "^7.0.
|
|
72
|
-
"@turf/helpers": "^7.0.
|
|
71
|
+
"@turf/destination": "^7.1.0-alpha.70+948cdafaf",
|
|
72
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
73
|
+
"@types/geojson": "^7946.0.10",
|
|
73
74
|
"tslib": "^2.6.2"
|
|
74
75
|
},
|
|
75
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
76
77
|
}
|