WhiteboxTools Documentation

repository·master·Indexed 22 days ago

https://github.com/jblindsay/whitebox-tools

An advanced geospatial data analysis platform written in Rust for GIS operations, remote sensing, hydrological analysis, terrain analysis, and LiDAR processing. It functions as an analytical backend for visualization software and provides a command-line interface, a Python scripting API, and an experimental GUI runner. Supports various raster formats (GeoTIFF, ESRI ASCII, etc.) and LAS LiDAR files.

Tokens
32K
Snippets
85
Records
152
Agent score
79%

What's inside WhiteboxTools

  1. Overview of WhiteboxTools capabilities

    master

    WhiteboxTools is an advanced geospatial data analysis platform designed as an analytical backend for GIS software. It is written in Rust to leverage high performance and parallel processing.

    Core Capabilities:

    • GIS Analysis: Cost-distance analysis, distance buffering, and raster reclassification.
    • Remote Sensing: Image enhancement (panchromatic sharpening, contrast adjustments), mosaicing, filtering, and k-means classification.
    • Hydrological Analysis: Flow accumulation, watershed delineation, stream network analysis, and sink removal.
    • Terrain Analysis: Slope, curvature, wetness index, hillshading, hypsometric analysis, and multi-scale topographic position analysis.
    • LiDAR Processing: Point cloud interrogation (LidarInfo, LidarHistogram), segmentation, tiling, outlier analysis, and interpolation to rasters (DEMs, intensity images).

    Key Distinction: WhiteboxTools is not a cartographic or visualization package; it is intended to be used as a processing engine for other visualization software.

  2. Configure the default callback in whitebox_tools.py

    master
    In version 0.10.0 and later, the default callback in whitebox_tools.py can be modified. This allows you to specify a single custom callback (for example, to handle logging or progress updates) that will be used for all tool function calls without needing to pass it explicitly to every individual tool call.
  3. Perform in-place raster math operations

    master
    WhiteboxTools supports in-place mathematical operators (e.g., InPlaceAdd, InPlaceDivide, InPlaceMultiply, InPlaceSubtract). To use these, you must open the existing raster in write mode ('w'). This is useful for modifying a raster directly rather than creating a new output file.
  4. Supported Data Formats

    master

    Raster Formats

    WhiteboxTools supports reading and writing:

    • Whitebox raster data
    • GeoTIFF
    • ESRI (ArcGIS) ASCII and binary (.flt & .hdr)
    • GRASS GIS
    • Idrisi
    • SAGA GIS (binary and ASCII)
    • Surfer 7

    Note: The project aims to remain a pure Rust codebase and does not incorporate third-party libraries like GDAL.

    LiDAR Formats

    • LAS: Supported.
    • Compressed LAS (.zip): Supported. You can pass .las.zip files directly to tools. The library uses an efficient Rust compression library to handle these.
    • LAZ and ESRI LiDAR: Currently not supported.

    Vector Formats

    • Support for Shapefile and GeoJSON is currently limited but is planned for enhancement.
  5. Use WhiteboxTools via Docker

    master

    You can run WhiteboxTools within a Docker container. This is useful if you prefer not to build from source or cannot use the available binaries.

    1. Build the Docker image:

    git clone https://github.com/jblindsay/whitebox-tools.git
    cd /path/to/folder/whitebox-tools/
    docker build -t whitebox-tools -f docker/whitebox-tools.dockerfile .

    2. Run the container: To process data, you must bind mount your local data directory to the /data path inside the container. Pass your tool arguments after the image name.

    Example command:

    docker run --rm -it -v "/path/to/data/directory/":/data whitebox-tools --run=IntegralImage -i=dem.tif -o=out.tif

    Note: In the example above, dem.tif and out.tif are assumed to be located within the mounted /data directory.

    docker build -t whitebox-tools -f docker/whitebox-tools.dockerfile .
    
    docker run --rm -it -v "/path/to/data/directory/":/data whitebox-tools --run=IntegralImage -i=dem.tif -o=out.tif
  6. Use WhiteboxTools Runner (GUI)

    master

    The wb_runner.py script provides a basic, experimental, cross-platform graphical user interface (GUI) using Python's TkInter library. It allows users to call tools and provide arguments through a visual interface.

    Requirements:

    • The script must be run from a directory that contains both the whitebox_tools.py Python script and the whitebox_tools executable file.
    • It is independent of the larger Whitebox GAT user interface.
  7. System requirements for WhiteboxTools

    master

    WhiteboxTools performance depends on the scale of your analysis and data. Because the library reads entire raster datasets into system memory for optimal performance, RAM is often the primary limiting factor for large datasets.

    Recommended Minimum Specifications:

    • Memory (RAM): 8-16GB
    • Processor: Modern multi-core processor (e.g., 64-bit i5 or i7)
    • Storage: Solid-state-drive (SSD)
    • Operating System: 64-bit OS is highly recommended. Extensive testing has not been performed on 32-bit systems.
  8. Install WhiteboxTools via pre-compiled binaries

    master

    WhiteboxTools is a stand-alone executable command-line program that does not require a traditional installation process.

    To use the program:

    1. Download the pre-compiled binary for your operating system from the Geomorphometry and Hydrogeomatics Research Group website.
    2. If you intend to use the Python programming interface, ensure you have Python 3 or higher installed on your system.
  9. Run WhiteboxTools via the Tkinter User Interface

    master

    For a graphical user interface (GUI) that allows you to run tools and specify parameters without using the command line, use the included wb_runner.py script. This requires Python to be installed.

    From the directory containing the script, run:

    python wb_runner.py

    (Or python3 wb_runner.py depending on your system configuration).