3.0.12 • Published 8 years ago

turf-circle v3.0.12

Weekly downloads
9,933
License
MIT
Repository
github
Last release
8 years ago

turf-circle

build status

turf circle module

turf.circle(center, radius, steps, units)

Takes a Point and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.

Parameters

parametertypedescription
centerFeature.\<Point>center point
radiusNumberradius of the circle
stepsNumbernumber of steps
unitsStringmiles, kilometers, degrees, or radians

Example

var center = {
  "type": "Feature",
  "properties": {
    "marker-color": "#0f0"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [-75.343, 39.984]
  }
};
var radius = 5;
var steps = 10;
var units = 'kilometers';

var circle = turf.circle(center, radius, steps, units);

var result = {
  "type": "FeatureCollection",
  "features": [center, circle]
};

//=result

Returns Feature.<Polygon>, circle polygon

Installation

Requires nodejs.

$ npm install turf-circle

Tests

$ npm test