@turf/circle
Advanced tools
Comparing version 5.0.0 to 5.0.4
@@ -1,2 +0,2 @@ | ||
import { Feature, Point, Polygon, Units, Position } from '@turf/helpers' | ||
import { Feature, Coord, Polygon, Units, Properties } from '@turf/helpers' | ||
@@ -7,9 +7,9 @@ /** | ||
export default function ( | ||
center: Feature<Point> | Point | Position, | ||
radius: number, | ||
options?: { | ||
steps?: number; | ||
units?: Units; | ||
properties?: object; | ||
} | ||
center: Coord, | ||
radius: number, | ||
options?: { | ||
steps?: number; | ||
units?: Units; | ||
properties?: Properties; | ||
} | ||
): Feature<Polygon>; |
10
index.js
@@ -18,8 +18,5 @@ import destination from '@turf/destination'; | ||
* var radius = 5; | ||
* var steps = 10; | ||
* var units = 'kilometers'; | ||
* var properties = {foo: 'bar'}; | ||
* var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}}; | ||
* var circle = turf.circle(center, radius, options); | ||
* | ||
* var circle = turf.circle(center, radius, steps, units, properties); | ||
* | ||
* //addToMap | ||
@@ -32,3 +29,2 @@ * var addToMap = [turf.point(center), circle] | ||
var steps = options.steps || 64; | ||
var units = options.units; | ||
var properties = options.properties; | ||
@@ -48,3 +44,3 @@ | ||
for (var i = 0; i < steps; i++) { | ||
coordinates.push(destination(center, radius, i * 360 / steps, units).geometry.coordinates); | ||
coordinates.push(destination(center, radius, i * -360 / steps, options).geometry.coordinates); | ||
} | ||
@@ -51,0 +47,0 @@ coordinates.push(coordinates[0]); |
10
main.js
@@ -22,8 +22,5 @@ 'use strict'; | ||
* var radius = 5; | ||
* var steps = 10; | ||
* var units = 'kilometers'; | ||
* var properties = {foo: 'bar'}; | ||
* var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}}; | ||
* var circle = turf.circle(center, radius, options); | ||
* | ||
* var circle = turf.circle(center, radius, steps, units, properties); | ||
* | ||
* //addToMap | ||
@@ -36,3 +33,2 @@ * var addToMap = [turf.point(center), circle] | ||
var steps = options.steps || 64; | ||
var units = options.units; | ||
var properties = options.properties; | ||
@@ -52,3 +48,3 @@ | ||
for (var i = 0; i < steps; i++) { | ||
coordinates.push(destination(center, radius, i * 360 / steps, units).geometry.coordinates); | ||
coordinates.push(destination(center, radius, i * -360 / steps, options).geometry.coordinates); | ||
} | ||
@@ -55,0 +51,0 @@ coordinates.push(coordinates[0]); |
{ | ||
"name": "@turf/circle", | ||
"version": "5.0.0", | ||
"version": "5.0.4", | ||
"description": "turf circle module", | ||
@@ -17,3 +17,2 @@ "main": "main", | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "uglifyjs main.js -o main.min.js", | ||
"bench": "node -r @std/esm bench.js" | ||
@@ -40,14 +39,14 @@ }, | ||
"devDependencies": { | ||
"@turf/truncate": "*", | ||
"@mapbox/geojsonhint": "*", | ||
"@std/esm": "*", | ||
"@turf/truncate": "^5.0.4", | ||
"benchmark": "*", | ||
"load-json-file": "*", | ||
"rollup": "*", | ||
"tape": "*", | ||
"write-json-file": "*", | ||
"rollup": "*", | ||
"@std/esm": "*", | ||
"uglify-js": "*" | ||
"write-json-file": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/destination": "5.0.0", | ||
"@turf/helpers": "5.0.0" | ||
"@turf/destination": "^5.0.4", | ||
"@turf/helpers": "^5.0.4" | ||
}, | ||
@@ -54,0 +53,0 @@ "@std/esm": { |
@@ -13,6 +13,6 @@ # @turf/circle | ||
- `radius` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** radius of the circle | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters | ||
- `steps` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of steps (optional, default `64`) | ||
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** miles, kilometers, degrees, or radians (optional, default `"kilometers"`) | ||
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** properties (optional, default `{}`) | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`) | ||
- `options.steps` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of steps (optional, default `64`) | ||
- `options.units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** miles, kilometers, degrees, or radians (optional, default `'kilometers'`) | ||
- `options.properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** properties (optional, default `{}`) | ||
@@ -24,8 +24,5 @@ **Examples** | ||
var radius = 5; | ||
var steps = 10; | ||
var units = 'kilometers'; | ||
var properties = {foo: 'bar'}; | ||
var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}}; | ||
var circle = turf.circle(center, radius, options); | ||
var circle = turf.circle(center, radius, steps, units, properties); | ||
//addToMap | ||
@@ -32,0 +29,0 @@ var addToMap = [turf.point(center), circle] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8785
102
56
+ Added@turf/destination@5.1.5(transitive)
+ Added@turf/helpers@5.1.5(transitive)
+ Added@turf/invariant@5.2.0(transitive)
- Removed@turf/destination@5.0.0(transitive)
- Removed@turf/helpers@5.0.0(transitive)
- Removed@turf/invariant@5.0.0(transitive)
Updated@turf/destination@^5.0.4
Updated@turf/helpers@^5.0.4