Crate odjitter

Crate odjitter 

Source
Expand description

§odjitter: Jitter Origin-Destination Data

This crate transforms origin/destination (OD) data aggregated by zone into a disaggregated form, by sampling specific points from the zone. This technique is known as “jittering” and is particularly useful for modeling active travel modes and generating realistic route networks.

§What is jittering?

Jittering is a method that takes OD data in a CSV file plus zones and geographic datasets representing trip start and end points in GeoJSON files, and outputs geographic lines representing movement between the zones. The name comes from jittering in a data visualization context, which refers to the addition of random noise to the location of points, preventing them from overlapping.

§Why jitter?

For a detailed description of the method and an explanation of why it is useful, especially when modeling active modes that require dense active travel networks, see the paper:

Lovelace, R., Félix, R., & Carlino, D. (2022). Jittering: A Computationally Efficient Method for Generating Realistic Route Networks from Origin-Destination Data. Findings, 33873. https://doi.org/10.32866/001c.33873

§Example Usage

The crate provides both a command-line interface and a library API. For command-line usage, see the README. For library usage:

use odjitter::{jitter, Options, Subsample};

// Configure jittering options
let options = Options {
    subsample_origin: Subsample::RandomPoints,
    subsample_destination: Subsample::RandomPoints,
    origin_key: "geo_code1".to_string(),
    destination_key: "geo_code2".to_string(),
    min_distance_meters: 1.0,
    deduplicate_pairs: false,
};

// Then use jitter() to process your OD data
// See documentation for full details on parameters

§Features

  • Fast: Implemented in Rust for high performance
  • Flexible: Support for weighted sampling and custom subpoints
  • Geographic: Works with GeoJSON files and WGS84 coordinates
  • Reproducible: Optional RNG seeding for deterministic results

Structs§

Options
Configuration options for the jittering process.
WeightedPoint
A point with an associated relative weight. Higher weights are more likely to be sampled.

Enums§

Subsample
Specifies how specific points should be generated within a zone.

Functions§

disaggregate
This method transforms aggregate origin/destination pairs into a fully disaggregated form, by sampling specific points from the zone.
jitter
Transforms aggregate origin/destination pairs into a disaggregated form by sampling specific points from zones.
load_zones
Extract multipolygon zones from a GeoJSON file, using the provided name_key as the key in the resulting map.
scrape_points
Extracts all points from a GeoJSON file for use as origin/destination subpoints.