@turf/circle 7.1.0 → 7.3.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 +13 -13
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +3 -3
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
## circle
|
|
6
6
|
|
|
7
|
-
Takes a [Point][1] and calculates the circle polygon given a radius in
|
|
7
|
+
Takes a [Point][1] and calculates the circle polygon given a radius in [Units][2]; and steps for precision.
|
|
8
8
|
|
|
9
9
|
### Parameters
|
|
10
10
|
|
|
11
|
-
* `center` **([Feature][
|
|
12
|
-
* `radius` **[number][
|
|
13
|
-
* `options` **[Object][
|
|
11
|
+
* `center` **([Feature][3]<[Point][1]> | [Array][4]<[number][5]>)** center point
|
|
12
|
+
* `radius` **[number][5]** radius of the circle
|
|
13
|
+
* `options` **[Object][6]** Optional parameters (optional, default `{}`)
|
|
14
14
|
|
|
15
|
-
* `options.steps` **[number][
|
|
16
|
-
* `options.units` **
|
|
17
|
-
* `options.properties` **[Object][
|
|
15
|
+
* `options.steps` **[number][5]** number of steps (optional, default `64`)
|
|
16
|
+
* `options.units` **Units** Supports all valid Turf [Units][2] (optional, default `'kilometers'`)
|
|
17
|
+
* `options.properties` **[Object][6]** properties (optional, default `{}`)
|
|
18
18
|
|
|
19
19
|
### Examples
|
|
20
20
|
|
|
@@ -28,19 +28,19 @@ var circle = turf.circle(center, radius, options);
|
|
|
28
28
|
var addToMap = [turf.point(center), circle]
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Returns **[Feature][
|
|
31
|
+
Returns **[Feature][3]<[Polygon][7]>** circle polygon
|
|
32
32
|
|
|
33
33
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
34
34
|
|
|
35
|
-
[2]: https://
|
|
35
|
+
[2]: https://turfjs.org/docs/api/types/Units
|
|
36
36
|
|
|
37
|
-
[3]: https://
|
|
37
|
+
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
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/Array
|
|
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/Number
|
|
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/Object
|
|
44
44
|
|
|
45
45
|
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
46
46
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -13,9 +13,9 @@ function circle(center, radius, options = {}) {
|
|
|
13
13
|
coordinates.push(coordinates[0]);
|
|
14
14
|
return _helpers.polygon.call(void 0, [coordinates], properties);
|
|
15
15
|
}
|
|
16
|
-
var
|
|
16
|
+
var index_default = circle;
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.circle = circle; exports.default =
|
|
20
|
+
exports.circle = circle; exports.default = index_default;
|
|
21
21
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,gDAA4B;AAC5B,wCAA+B;AAsB/B,SAAS,MAAA,CACP,MAAA,EACA,MAAA,EACA,QAAA,EAII,CAAC,CAAA,EACgB;AAErB,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,MAAA,GAAS,EAAA;AAC/B,EAAA,MAAM,WAAA,EAAkB,OAAA,CAAQ,WAAA,EAC5B,OAAA,CAAQ,WAAA,EACR,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,EAAA,GAAK,MAAA,CAAO,KAAA,IAAS,UAAA,GAAa,MAAA,CAAO,WAAA,EAC5D,MAAA,CAAO,WAAA,EACP,CAAC,CAAA;AAGP,EAAA,MAAM,YAAA,EAAc,CAAC,CAAA;AACrB,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,KAAA,EAAO,CAAA,EAAA,EAAK;AAC9B,IAAA,WAAA,CAAY,IAAA;AAAA,MACV,sCAAA,MAAY,EAAQ,MAAA,EAAS,EAAA,EAAI,CAAA,IAAA,EAAQ,KAAA,EAAO,OAAO,CAAA,CAAE,QAAA,CACtD;AAAA,IACL,CAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,IAAA,CAAK,WAAA,CAAY,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAO,8BAAA,CAAS,WAAW,CAAA,EAAG,UAAU,CAAA;AAC1C;AAGA,IAAO,cAAA,EAAQ,MAAA;ADvCf;AACE;AACA;AACF,yDAAC","file":"/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","sourcesContent":[null,"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 {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.\n *\n * @function\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 {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}\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/cjs/index.d.cts
CHANGED
|
@@ -2,14 +2,14 @@ import { GeoJsonProperties, Point, Feature, Polygon } from 'geojson';
|
|
|
2
2
|
import { Units } from '@turf/helpers';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Takes a {@link Point} and calculates the circle polygon given a radius in
|
|
5
|
+
* Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Feature<Point>|number[]} center center point
|
|
9
9
|
* @param {number} radius radius of the circle
|
|
10
10
|
* @param {Object} [options={}] Optional parameters
|
|
11
11
|
* @param {number} [options.steps=64] number of steps
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}
|
|
13
13
|
* @param {Object} [options.properties={}] properties
|
|
14
14
|
* @returns {Feature<Polygon>} circle polygon
|
|
15
15
|
* @example
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { GeoJsonProperties, Point, Feature, Polygon } from 'geojson';
|
|
|
2
2
|
import { Units } from '@turf/helpers';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Takes a {@link Point} and calculates the circle polygon given a radius in
|
|
5
|
+
* Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Feature<Point>|number[]} center center point
|
|
9
9
|
* @param {number} radius radius of the circle
|
|
10
10
|
* @param {Object} [options={}] Optional parameters
|
|
11
11
|
* @param {number} [options.steps=64] number of steps
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}
|
|
13
13
|
* @param {Object} [options.properties={}] properties
|
|
14
14
|
* @returns {Feature<Polygon>} circle polygon
|
|
15
15
|
* @example
|
package/dist/esm/index.js
CHANGED
|
@@ -13,9 +13,9 @@ function circle(center, radius, options = {}) {
|
|
|
13
13
|
coordinates.push(coordinates[0]);
|
|
14
14
|
return polygon([coordinates], properties);
|
|
15
15
|
}
|
|
16
|
-
var
|
|
16
|
+
var index_default = circle;
|
|
17
17
|
export {
|
|
18
18
|
circle,
|
|
19
|
-
|
|
19
|
+
index_default as default
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
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
|
|
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 {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.\n *\n * @function\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 {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}\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,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/circle",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Takes a point and calculates the circle polygon given a radius.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -55,23 +55,23 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@placemarkio/check-geojson": "^0.1.12",
|
|
58
|
-
"@turf/truncate": "
|
|
58
|
+
"@turf/truncate": "7.3.0",
|
|
59
59
|
"@types/benchmark": "^2.1.5",
|
|
60
|
-
"@types/tape": "^
|
|
60
|
+
"@types/tape": "^5.8.1",
|
|
61
61
|
"benchmark": "^2.1.4",
|
|
62
62
|
"load-json-file": "^7.0.1",
|
|
63
63
|
"npm-run-all": "^4.1.5",
|
|
64
|
-
"tape": "^5.
|
|
65
|
-
"tsup": "^8.0
|
|
66
|
-
"tsx": "^4.
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"write-json-file": "^
|
|
64
|
+
"tape": "^5.9.0",
|
|
65
|
+
"tsup": "^8.4.0",
|
|
66
|
+
"tsx": "^4.19.4",
|
|
67
|
+
"typescript": "^5.8.3",
|
|
68
|
+
"write-json-file": "^6.0.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@turf/destination": "
|
|
72
|
-
"@turf/helpers": "
|
|
71
|
+
"@turf/destination": "7.3.0",
|
|
72
|
+
"@turf/helpers": "7.3.0",
|
|
73
73
|
"@types/geojson": "^7946.0.10",
|
|
74
|
-
"tslib": "^2.
|
|
74
|
+
"tslib": "^2.8.1"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
77
77
|
}
|