A modular geospatial engine written in JavaScript
JavaScript TypeScript
Latest commit aa968f8 Feb 23, 2017 @rowanwins rowanwins committed with DenisCarriere Initial commit of @turf/unkink-polygon (#579)
* Initial commit of @turf/unkink-polygon

* Dynamic GeoJSON tests & Benchmark
- Added `test/in` & `test/out` to be able to preview the input & output as GeoJSON. Major benefit with this we would simply need to add a new GeoJSON in the `test/in` folder to perform a new test, no need to include more in the `test.js`.
- Added benchmark test
- Fix minor JSDocs

CC: @rowanwins

* Include files
- Removes any `test` and extra files not needed for npm publish
- Added bench to npm scripts

* Suport MultiPolygon & FeatureCollections
- Added `stroke` to GeoJSON input to be able to visually see the different features
- Updated benchmark
- Updated tests
- Updated Tyepscript definition
- Added Typescript basic test
CC: @rowanwins

* Update JSDocs to include MultiPolygon

* Update unkink types

* Add README to unkink

* Remove equals turf-unkink
- deepEquals would catch the same errors as equals

* Change license to TurfJS



Version Badge Circle CI Travis CI Gitter chat

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 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/point @turf/buffer

Bower [NOTE: Bower support will be dropped Jan 1st 2017]:

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

The latest Bower build is at:



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

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 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: {}