A modular geospatial engine written in JavaScript
Switch branches/tags
1422-voronoi-type abelvm/kernelDensity along-patch boolean-is-concave center-of-mass-fix clusters-mutate convert-to-typescript earth-radius ellipse-rotation-fix experimental-mjs greenkeeper/documentation-9.0.0 greenkeeper/documentation-pin-8.1.2 greenkeeper/fs-extra-7.0.1 greenkeeper/fs-extra-pin-7.0.0 greenkeeper/lerna-2.10.0 greenkeeper/lerna-2.10.1 greenkeeper/lerna-2.11.0 greenkeeper/lerna-3.0.0 greenkeeper/lerna-3.0.1 greenkeeper/lerna-3.0.2 greenkeeper/lerna-3.0.3 greenkeeper/lerna-3.0.4 greenkeeper/lerna-3.0.5 greenkeeper/lerna-3.0.6 greenkeeper/lerna-3.1.0 greenkeeper/lerna-3.1.1 greenkeeper/lerna-3.1.2 greenkeeper/lerna-3.2.0 greenkeeper/lerna-3.2.1 greenkeeper/lerna-3.3.0 greenkeeper/lerna-3.3.1 greenkeeper/lerna-3.3.2 greenkeeper/lerna-3.4.0 greenkeeper/lerna-3.4.1 greenkeeper/lerna-3.4.2 greenkeeper/lerna-3.4.3 greenkeeper/lerna-3.5.0 greenkeeper/lerna-3.5.1 greenkeeper/lerna-3.6.0 greenkeeper/load-json-file-5.1.0 greenkeeper/load-json-file-pin-5.0.0 greenkeeper/progress-2.0.1 greenkeeper/progress-pin-2.0.0 greenkeeper/rollup-0.66.0 greenkeeper/rollup-0.66.1 greenkeeper/rollup-0.66.2 greenkeeper/rollup-0.66.3 greenkeeper/rollup-0.66.4 greenkeeper/rollup-0.66.5 greenkeeper/rollup-0.66.6 greenkeeper/rollup-0.67.0 greenkeeper/rollup-0.67.1 greenkeeper/rollup-0.67.2 greenkeeper/rollup-0.67.3 greenkeeper/rollup-pin-0.65.2 greenkeeper/rollup-pin-0.66.0 greenkeeper/rollup-pin-0.66.2 greenkeeper/rollup-pin-0.66.3 greenkeeper/rollup-pin-0.66.4 greenkeeper/rollup-pin-0.66.5 greenkeeper/rollup-pin-0.66.6 greenkeeper/rollup-pin-0.67.1 greenkeeper/rollup-plugin-typescript-1.0.0 greenkeeper/rollup-plugin-typescript-pin-0.8.1 greenkeeper/@types/node-10.10.0 greenkeeper/@types/node-10.10.1 greenkeeper/@types/node-10.10.2 greenkeeper/@types/node-10.10.3 greenkeeper/@types/node-10.11.0 greenkeeper/@types/node-10.11.1 greenkeeper/@types/node-10.11.2 greenkeeper/@types/node-10.11.3 greenkeeper/@types/node-10.11.4 greenkeeper/@types/node-10.11.5 greenkeeper/@types/node-10.11.6 greenkeeper/@types/node-10.11.7 greenkeeper/@types/node-10.12.0 greenkeeper/@types/node-10.12.1 greenkeeper/@types/node-10.12.2 greenkeeper/@types/node-10.12.3 greenkeeper/@types/node-10.12.4 greenkeeper/@types/node-10.12.5 greenkeeper/@types/node-10.12.6 greenkeeper/@types/node-10.12.7 greenkeeper/@types/node-10.12.8 greenkeeper/@types/node-10.12.9 greenkeeper/@types/node-10.12.10 greenkeeper/@types/node-10.12.11 greenkeeper/@types/node-10.12.12 greenkeeper/@types/node-10.12.13 greenkeeper/@types/node-10.12.14 greenkeeper/@types/node-pin-10.9.4 greenkeeper/@types/node-pin-10.10.0 greenkeeper/@types/node-pin-10.11.4 greenkeeper/@types/node-pin-10.11.5 greenkeeper/@types/node-pin-10.11.7 greenkeeper/@types/node-pin-10.12.7 greenkeeper/@types/node-pin-10.12.10 greenkeeper/@types/node-pin-10.12.12 greenkeeper/update-to-node-10 intersect invariant-first-last-coord last-first-segment line-split-fix master nearest-neighbour rectangleGrid refactoring-typescript remove-jsts-intersect remove-jsts-martinez remove-jsts-union slice stevage-patch-1 tangent-patch test-examples turf-meta typo v7
Nothing to show
Clone or download
Latest commit 1ea2648 Oct 2, 2018



Version Badge Travis CI Gitter chat Backers on Open Collective Sponsors on Open Collective Coverage Status Greenkeeper badge

A modular geospatial engine written in JavaScript


Turf is a JavaScript library for spatial analysis. It includes traditional spatial operations, helper functions for creating GeoJSON data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can run Turf server-side with Node.js (see below).


In Node.js

npm install @turf/turf

In browser

Download the minified file, and include it in a script tag. This will expose a global variable named turf.

<script src="turf.min.js" charset="utf-8"></script>

You can also include it directly from a CDN:

<script src="https://cdn.jsdelivr.net/npm/@turf/turf@5/turf.min.js"></script>

You can create light-weight turf builds with only the functions you need using the turfjs-builder UI or using browserify as described below.


All of Turf's functions can also be installed as separate modules. This works well with tools like browserify where you want to install only the code you need. It also allows you to mix and match modules. This is the recommended usage pattern for most production environments. For example, to install the point and buffer modules use:

npm install @turf/helpers @turf/buffer

Bower [NOTE: Bower support has been dropped Jan 1st 2017]

Not recommended. Please don't use Bower. Use Browserify, Webpack, or the CDN instead.


TypeScript is supported internally within each module, no installs required.

Other languages

Ports of Turf.js are available in:

Turf for Swift is experimental and its public API is subject to change. Please use with care.

Data in Turf

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

NOTE: Turf expects data in (longitude, latitude) order per the GeoJSON standard.

Most Turf functions work with GeoJSON features. These 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:

  • Point
  • LineString
  • Polygon

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:

// Note order: longitude, latitude.
var point1 = turf.point([-73.988214, 40.749128]);

var point2 = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    // Note order: longitude, latitude.
    coordinates: [-73.988214, 40.749128]
  properties: {}


This project exists thanks to all the people who contribute. [Contribute].


Thank you to all our backers! 🙏 [Become a backer]


Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]