Turf Geospatial Engine

repository·master·Indexed 27 days ago

https://github.com/turfjs/turf

A 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.

Tokens
85.5K
Snippets
344
Records
540
Agent score
87%

What's inside Turf

  1. Overview of Turf

    master
    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.
  2. Overview of Turf geospatial analysis engine

    master
    Turf 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.
  3. Understand the structure of a Turf package

    master

    Turf 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 using tape.
    • package.json: Node metadata. Dependencies for the package go in dependencies, while test/bench dependencies go in devDependencies.
    • 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/in and expected output is in ./test/out.
  4. Prepare a local environment for Turf releases

    master

    To 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.

    git clone git@github.com:Turfjs/turf.git turf-release
    cd turf-release
    pnpm install
    pnpm test

    Option 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 test