https://github.com/turfjs/turf-buffer
Buffers a point, linestring, or polygon Feature/FeatureCollection to a given radius. Units supported are miles, kilometers, and degrees.
https://github.com/turfjs/turf-buffer
Last synced: 3 months ago
JSON representation
Buffers a point, linestring, or polygon Feature/FeatureCollection to a given radius. Units supported are miles, kilometers, and degrees.
- Host: GitHub
- URL: https://github.com/turfjs/turf-buffer
- Owner: Turfjs
- License: mit
- Created: 2014-05-23T04:00:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-06T13:38:55.000Z (over 8 years ago)
- Last Synced: 2025-08-21T16:28:53.038Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 146 KB
- Stars: 23
- Watchers: 8
- Forks: 27
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED - replaced with [`@turf/buffer`](https://github.com/Turfjs/turf/tree/master/packages/turf-buffer)
# turf-buffer
[](http://travis-ci.org/Turfjs/turf-buffer)
turf buffer module
### `turf.buffer(feature, distance, unit)`
Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
### Parameters
| parameter | type | description |
| ---------- | -------------------------- | ----------------------------------------------------- |
| `feature` | Feature\,FeatureCollection | input to be buffered |
| `distance` | Number | distance to draw the buffer |
| `unit` | String | 'miles', 'feet', 'kilometers', 'meters', or 'degrees' |
### Example
```js
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, pt]);
//=result
```
**Returns** `FeatureCollection.,FeatureCollection.,Polygon,MultiPolygon`, buffered features
## Installation
Requires [nodejs](http://nodejs.org/).
```sh
$ npm install turf-buffer
```
## Tests
```sh
$ npm test
```