[][src]Crate space_time

Partial port of the scala-based geomesa-z3 library from geomesa Partial port of sfcurve scala space-filling curve library.

Useful for representing and querying spatial objects

Z2 curve is used for two dimensional point indexing and can be accessed through the SpaceFillingCurves factory.

use space_time::SpaceFillingCurves;

let curve = SpaceFillingCurves::get_point_curve(1024, -180.0, -90.0, 180.0, 90.0);
let indexed_point = curve.index(2.3522, 48.8566);
let range_of_index = curve.ranges(2.35, 48.85, 2.354, 48.857, &[]);

assert!(range_of_index
    .iter()
    .any(|r| r.lower() <= indexed_point && r.upper() >= indexed_point));

Z3 curve is used for two dimensional point and time indexing and can be accessed through the SpaceTimeFillingCurves factory.

use space_time::SpaceTimeFillingCurves;

let curve = SpaceTimeFillingCurves::get_point_curve(1024, -180.0, -90.0, 180.0, 90.0, 159753997829.0);
let indexed_point_in_time = curve.index(2.3522, 48.8566, 1587583997829.0); // Paris, France. April 22, 2020 as milliseconds since Unix Epoch.
let range_of_index = curve.ranges(2.3522, 48.85, 2.354, 48.857, 1587583997828.0, 1587583997828.0, &[]);

assert!(range_of_index.iter().any(|r| r.lower() <= indexed_point_in_time && r.upper() >= indexed_point_in_time));

Extended Z-order curves are used for non-points. XZ2SFC for spatial indexing of non-points.

use space_time::SpaceFillingCurves;

let curve = SpaceFillingCurves::get_non_point_curve(12, -180.0, -90.0, 180.0, 90.0);
let indexed_polygon = curve.index(2.3522, 48.8466, 2.39, 49.9325);
let range_of_index = curve.ranges(2.0, 48.0, 3.0, 50.0, None);

assert!(range_of_index
    .iter()
    .any(|r| r.lower() <= indexed_polygon && r.upper() >= indexed_polygon));

XZ3SFC for spatial-temporal indexing of non-points.

use space_time::SpaceTimeFillingCurves;

let curve = SpaceTimeFillingCurves::get_non_point_curve(
    12,
    -180.0,
    -90.0,
    0.0,
    180.0,
    90.0,
    1_893_456_000.0,
);

let indexed_polygon = curve.index(
    2.3522,
    48.8466,
    1_556_496_000.0,
    2.39,
    49.9325,
    1_556_496_000.0,
);

let range_of_index = curve.ranges(2.0, 48.0, 1_556_300_000.0, 3.0, 50.0, 1_557_496_000.0, None);

assert!(range_of_index
    .iter()
    .any(|r| r.lower() <= indexed_polygon && r.upper() >= indexed_polygon));

Modules

index_range

Contains trait IndexRange and concrete structs CoveredRange and OverlappingRange. IndexRange has Ord so is sortable.

xzorder

Extended Z-Order curve for non-points

zorder

Provides a Z-Order curve implementation of SpaceFillingCurve2D.

Structs

SpaceFillingCurves

Factory providing space filling curves

SpaceTimeFillingCurves

Factory providing space-time filling curves

Enums

RangeComputeHints

Hints to the range function implementation for SpacefillingCurve2Ds.