
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
- 11 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
How to get it
- 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
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
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
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| turf (this) | 10.5k | Library | intermediate | 11 days ago | Developers adding map-related calculations to a website or web app |
| kepler.gl | 12.1k | Library | intermediate | 4 days ago | Developers who want to add map-based data exploration to a React and Redux app |
| algorithms | 25.6k | Library | beginner | 1 months ago | Students studying data structures and algorithms |
| homemade-machine-learning | 24.8k | Learning resource | beginner | 12 months ago | Students 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.