@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
30 lines (29 loc) • 650 B
JavaScript
import { RouteLegStep } from "./route-leg-step";
export class RouteLeg {
constructor(raw) {
if (raw) {
this.raw = raw;
}
else {
throw new Error("RouteLegData is undefined");
}
}
getRaw() {
return this.raw;
}
getTime() {
return this.raw.time;
}
getDistance() {
return this.raw.distance;
}
getSteps() {
return this.raw.steps.map((step) => new RouteLegStep(step));
}
getFromWaypointIndex() {
return this.raw.from_waypoint_index;
}
getToWaypointIndex() {
return this.raw.to_waypoint_index;
}
}