@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
22 lines (21 loc) • 948 B
JavaScript
import { Utils } from "./utils";
export class RoutePlannerResultConverter {
static generateRoutePlannerResultData(response) {
var _a, _b, _c;
let clonedResponse = Utils.cloneObject(response);
return {
agents: this.generateAgents(clonedResponse),
inputData: clonedResponse.properties.params,
unassignedAgents: (_a = clonedResponse.properties.issues) === null || _a === void 0 ? void 0 : _a.unassigned_agents,
unassignedJobs: (_b = clonedResponse.properties.issues) === null || _b === void 0 ? void 0 : _b.unassigned_jobs,
unassignedShipments: (_c = clonedResponse.properties.issues) === null || _c === void 0 ? void 0 : _c.unassigned_shipments
};
}
static generateAgents(response) {
let result = [];
response.features.forEach((feature) => {
result.push(feature.properties);
});
return result;
}
}