Atlaslog
Atlaslog / Turf.js / API / buffer
Turf.js · API reference

buffer

Quick answer

Calculates a buffer for input features for a given radius.

Last verified 2026-11-03 · Turf.js 7.x · Cite this page
Runnable examplesChinese noteAll API topics

Description​

Calculates a buffer for input features for a given radius.

When using a negative radius, the resulting geometry may be invalid if it's too small compared to the radius magnitude. If the input is a FeatureCollection, only valid members will be returned in the output FeatureCollection - i.e., the output collection may have fewer members than the input, or even be empty.

Parameters​

NameTypeDescription
geojsonFeatureCollection | Geometry | Feature<any>input to be buffered
radiusnumberdistance to draw the buffer (negative values are allowed)
options?ObjectOptional parameters (default {})
options.units?UnitsSupports all valid Turf Units. (default "kilometers")
options.steps?numbernumber of steps (default 8)

Returns​

FeatureCollection | Feature<Polygon | MultiPolygon> | undefined buffered features

Examples​

var point = turf.point([-90.54863, 14.616599]);
var buffered = turf.buffer(point, 500, { units: "miles" });

Installation​

$ npm install @turf/buffer

import { buffer } from "@turf/buffer";
const result = buffer(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.buffer(...);
TutorialsAPI index
English reference text adapted from the official Turf.js documentation, © Turf.js contributors, licensed under MIT.
Original page: https://turfjs.org/docs/api/buffer · Chinese note: /turf/api/buffer.html
Cite this page

Atlaslog (2026). buffer. https://www.jingweizhi.com/en/turf/api/buffer.html (accessed 2026-11-03).