Getting Started

Turf can be used as a framework, or as a collection of tiny modules.


npm install turf
...then call functions like this
var turf = require('turf')
turf.distance(home, store, 'miles')
turf.buffer(home, 3, 'miles')


npm install turf-distance
npm install turf-buffer
..then call functions like this
var distance = require('turf-distance')
var buffer = require('turf-buffer')
distance(home, store, 'miles')
buffer(home, 3, 'miles')


Turf uses GeoJSON for all geographic data. Turf expects the data to be standard WGS84 longitude, latitude coordinates. Check out for a tool to easily create this data.

Most Turf functions work with GeoJSON features. These are are pieces of data that represent a collection of properties (ie: population, elevation, zipcode, etc.) along with a geometry. GeoJSON has several geometry types such as:

Turf provides a few geometry functions of its own. These are nothing more than simple (and optional) wrappers that output plain old GeoJSON. For example, these two methods of creating a point are functionally equivalent:

var point1 = turf.point(0,0);

var point2 = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  properties: {}