Turf is a comprehensive, modular geospatial engine developed in JavaScript and TypeScript, designed to facilitate spatial analysis and manipulation of geographic data. Its primary focus is to provide a robust set of tools for working with GeoJSON, the widely adopted format for encoding geographic data structures. Turf enables developers to perform a wide range of spatial operations, such as measuring distances, calculating areas, buffering, intersecting, and manipulating geometries, all within the JavaScript ecosystem.
One of the key strengths of Turf is its modular architecture. The library is composed of numerous small, focused modules, each responsible for a specific geospatial function. This modularity allows developers to include only the components they need in their projects, optimizing performance and reducing bundle sizes for web applications. Turf can be used both client-side in browsers and server-side with Node.js, making it versatile for a variety of application contexts, from interactive web maps to backend geoprocessing services.
Turf offers a rich suite of traditional spatial operations, such as point-in-polygon tests, line intersections, and polygon unions. It also provides helper functions for creating and manipulating GeoJSON objects, which simplifies the process of generating and transforming geographic data. In addition to geometric operations, Turf includes tools for data classification and statistical analysis, enabling users to derive insights from spatial datasets, such as clustering points, calculating centroids, and summarizing properties across features.
The library is designed to be compatible with modern JavaScript runtimes. Node.js is the primary supported server-side environment, with recommendations to use active or maintenance LTS releases for best results. While other JavaScript runtimes like Deno or Bun are not officially supported, the maintainers are open to feedback and experiences from the community regarding their use. For browser environments, Turf leverages Babel to transpile its code, ensuring compatibility with a broad range of modern browsers as defined by the Browserslist criteria (>0.25% market share, last two versions, full ES5 support, and not obsolete).
Turf is an open-source project with an active community of contributors and supporters. The project encourages contributions and provides a detailed contributing guide for those interested in participating. It is supported by a network of backers and sponsors, whose contributions help sustain ongoing development and maintenance. The project maintains high standards for code quality, as evidenced by its continuous integration and code coverage badges.
Overall, Turf serves as a powerful and flexible toolkit for developers working with geospatial data in JavaScript. Its modular design, extensive feature set, and strong community support make it a go-to solution for spatial analysis tasks in both web and server environments. Whether building interactive mapping applications, performing complex geoprocessing, or analyzing geographic datasets, Turf provides the essential tools needed to handle geospatial workflows efficiently and effectively.