by Turfjs

Turfjs / turf

A modular geospatial engine written in JavaScript

5.6K Stars 648 Forks Last release: over 4 years ago (v3.0.11) MIT License 3.4K Commits 88 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


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


You can also include it directly from a CDN:

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:

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]

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.