Skip to content

Turf

A JavaScript/TypeScript library for geospatial analysis on GeoJSON data, usable in browsers and Node.js.

Stars
10.5k
Forks
1k
Licence
MIT
Language
TypeScript
Last update
10 days ago
Type
Library

What it is

Turf is a JavaScript library for spatial analysis. It includes common spatial operations, helper functions for creating GeoJSON data, and tools for data classification and statistics. It can run in a web page as a client-side module or on a server with Node.js.

  • Calculate distances, areas, or points within polygons on GeoJSON data
  • Generate GeoJSON features such as points, lines, and polygons from code
  • Run basic statistics or classify values across geographic features
  • Add spatial analysis to a website as a client-side module

Great for

  • Developers adding map-related calculations to a website or web app
  • Node.js developers who need server-side GeoJSON processing
  • Projects that already work with GeoJSON data
  • Teams that want to import only the modules they need

Not ideal for

  • People looking for a finished map application with no coding, since this is a code library
  • Projects needing runtimes other than Node.js or browsers, since Deno and Bun are not officially supported according to the README
  • Users who need a full GIS desktop tool like QGIS
Step-by-step guide: how to use TurfInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js (an Active or Maintenance LTS release is recommended)

    Install the full Turf package

    npm install @turf/turf
  2. 2

    Run it

    • Read the getting started guide at turfjs.org/docs/getting-started
    • Install the package with npm
    • Import the functions you need and pass them GeoJSON data
    • Check the API examples at turfjs.org for the function you want
  3. 3

    Get the most out of it

    • Import individual @turf modules instead of the full bundle to keep builds smaller, if your project allows it
    • Use the browser bundle included in @turf/turf for a single-file client-side setup
    • Follow the Browserslist-based browser targets when bundling for older browsers
    • Review the API examples on turfjs.org for the full list of operations

Downloads

Strengths

  • Modular design, so you can use individual packages instead of the whole library
  • Works in browsers and in Node.js, with a browser bundle provided
  • Written in TypeScript and published under the permissive MIT license

Trade-offs

  • Node.js is the first-class runtime; other runtimes like Deno or Bun are not officially supported
  • Browser builds may need your own transpiling and polyfilling to match target browsers
  • The README is truncated here, so specific function coverage and API details should be checked on turfjs.org

How it compares

ProjectStarsTypeLevelUpdatedBest for
turf (this)10.5kLibraryintermediate10 days agoDevelopers adding map-related calculations to a website or web app
kepler.gl12.1kLibraryintermediate4 days agoDevelopers who want to add map-based data exploration to a React and Redux app
algorithms25.6kLibrarybeginner1 months agoStudents studying data structures and algorithms
homemade-machine-learning24.8kLearning resourcebeginner12 months agoStudents learning the math behind machine learning algorithms

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.