Turf Geospatial Engine
repository·master·Indexed 27 days ago
https://github.com/turfjs/turfA modular geospatial engine for JavaScript that enables spatial analysis, GeoJSON creation, and statistical data classification. Designed to run in the browser and on the server via Node.js, Turf provides a comprehensive suite of modules for operations such as calculating geodesic area, finding bearings, clipping features to bounding boxes, and performing boolean geometry tests.
What's inside Turf
- Turf is a modular geospatial engine written in JavaScript designed for spatial analysis. It provides traditional spatial operations, helper functions for creating GeoJSON data, and tools for data classification and statistics. It can be used as a client-side module in web browsers or server-side in Node.js environments.
Overview of Turf geospatial analysis engine
masterTurf is a modular geospatial analysis engine written in JavaScript. It is designed to perform geospatial processing tasks using GeoJSON data. It is compatible with both server-side (Node.js) and client-side (browser) environments.Understand the structure of a Turf package
masterTurf is a monorepo where each submodule lives in the
packages/directory (e.g.,packages/turf-area). A typical package contains:index.ts: The core file containing TypeScript types, implementation, JSDoc documentation, and the single exported function.bench.ts: Performance benchmark tests using Benchmark.test.ts: Unit tests usingtape.package.json: Node metadata. Dependencies for the package go independencies, while test/bench dependencies go indevDependencies.README.md: Automatically generated. Do not edit this file manually.LICENSE: Do not edit.test/: Directory for GeoJSON data files. Input data is in./test/inand expected output is in./test/out.
Prepare a local environment for Turf releases
masterTo release Turf, you must work from a clean, local clone of the official Turf repository (not a fork). Ensure you have Turf repository write permissions and Turf npm organization publish permissions.
Option 1: Fresh Clone (Recommended)
git clone git@github.com:Turfjs/turf.git turf-release cd turf-release pnpm install pnpm testOption 2: Cleaning an existing copy
If using an existing copy, verify the remote origin and reset it to match the official repository:
git remote -v # Verify origin is https://github.com/Turfjs/turf.git git checkout master git reset --hard git fetch origin git rev-list master...origin/master # Output should be empty if in sync pnpm install pnpm testInstall @turf/point-to-line-distance
masterYou can install this module individually if you only need this specific functionality, or install the full
@turf/turfpackage to access all Turf modules as functions.$ npm install @turf/point-to-line-distanceInstall @turf/geojson-rbush
masterYou can install the
@turf/geojson-rbushmodule individually, or install the full@turf/turfpackage which includes all Turf modules.$ npm install @turf/geojson-rbushInstall @turf/point-grid
masterYou can install the
@turf/point-gridmodule individually, or install the full@turf/turfpackage which includes all Turf modules as functions.$ npm install @turf/point-gridOr install the all-encompassing @turf/turf module:
$ npm install @turf/turfInstall @turf/isobands
masterYou can install the isobands module individually or install the full@turf/turfpackage to access all Turf modules as functions.Install @turf/voronoi
masterYou can install the Voronoi module individually or install the full
@turf/turfpackage to access all Turf modules as functions.$ npm install @turf/voronoiOr
$ npm install @turf/turfInstall @turf/clusters-kmeans
masterYou can install this module individually or install the full
@turf/turfpackage which includes all Turf modules as functions.$ npm install @turf/clusters-kmeansInstall @turf/boolean-crosses
masterYou can install this specific module individually using npm.
$ npm install @turf/boolean-crossesInstall @turf/combine
masterYou can install the
@turf/combinemodule individually via npm.$ npm install @turf/combine