terra-route
    Preparing search index...

    Class TerraRoute

    Implements

    • Router
    Index

    Constructors

    • Parameters

      • Optionaloptions: {
            distanceMeasurement?: (a: Position, b: Position) => number;
            heap?: HeapConstructor;
        }

      Returns TerraRoute

    Methods

    • Builds a graph (CSR) from a LineString FeatureCollection. Two-pass build: pass 1 assigns node indices and counts degrees; pass 2 fills CSR arrays.

      Parameters

      • network: FeatureCollection<LineString>

      Returns void

    • Expands (merges) the existing graph with an additional LineString FeatureCollection.

      Parameters

      • network: FeatureCollection<LineString>

      Returns void

    • Computes the shortest route between two points in the network using the A* algorithm.

      Parameters

      • start: Feature<Point>

        A GeoJSON Point Feature representing the start location.

      • end: Feature<Point>

        A GeoJSON Point Feature representing the end location.

      Returns null | Feature<LineString, GeoJsonProperties>

      A GeoJSON LineString Feature representing the shortest path, or null if no path is found.

      Error if the network has not been built yet with buildRouteGraph(network).