turf.buffer

Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.

Parameters

Name Type Description
feature Feature | FeatureCollection

input to be buffered

distance Number

distance to draw the buffer

unit String

'miles', 'feet', 'kilometers', 'meters', or 'degrees'

Returns FeatureCollection.<Polygon> | FeatureCollection.<MultiPolygon> | Polygon | MultiPolygon

buffered features

Example

var pt = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-90.548630, 14.616599]
  }
};
var unit = 'miles';

var buffered = turf.buffer(pt, 500, unit);
var result = turf.featurecollection([buffered.features, pt]);

//=result
Library released under MIT license. © 2014 Morgan Herlocker.