@geoapify/route-planner-sdk
Version:
TypeScript SDK for the Geoapify Route Planner API. Supports route optimization, delivery planning, and timeline visualization in browser and Node.js
41 lines (40 loc) • 1.58 kB
TypeScript
import { RoutePlannerCallOptions } from "../../../../../models/interfaces/route-planner-call-options";
import { RoutingOptions } from '../../../../../models/interfaces/route-planner-input-data';
export interface RouteMatrixSource {
location: [number, number];
}
export interface RouteMatrixTarget {
location: [number, number];
}
export interface RouteMatrixEntry {
distance: number;
time: number;
source_index: number;
target_index: number;
}
export interface RouteMatrixResponse {
sources: Array<{
original_location: [number, number];
location: [number, number];
}>;
targets: Array<{
original_location: [number, number];
location: [number, number];
}>;
sources_to_targets: RouteMatrixEntry[][];
}
/**
* Helper class for Route Matrix API calls.
* Used for 1→N and N→1 travel time calculations when finding optimal insertion points.
*/
export declare class RouteMatrixHelper {
private baseUrl;
private apiKey;
private routingOptions;
constructor(options: RoutePlannerCallOptions, routingOptions: RoutingOptions);
calculateMatrix(sources: RouteMatrixSource[], targets: RouteMatrixTarget[]): Promise<RouteMatrixResponse>;
calculateTravelTime(from: [number, number], to: [number, number]): Promise<number>;
calculateTimesToLocation(routeLocations: [number, number][], targetLocation: [number, number]): Promise<number[]>;
calculateTimesFromLocation(sourceLocation: [number, number], routeLocations: [number, number][]): Promise<number[]>;
private toMatrixLocations;
}