Skip to content

API Overview

The Geoapify Route Optimization SDK provides a structured, TypeScript-first interface for interacting with the Geoapify Route Planner API. It simplifies the process of building and sending optimization requests, interpreting results, modifying assignments, and visualizing agent plans.

Modules

The SDK is organized into three key parts:

1. Core Classes

Class Purpose
RoutePlanner Build and execute route planning requests
RoutePlannerResult Parse and analyze route results
RoutePlannerResultEditor Reassign or modify jobs/shipments
RoutePlannerTimeline Render timelines for UI/visualization

2. Entities (Input Objects)

Use these to define the input for your route plan:

Entity Description
Agent Represents a resource (driver, worker, vehicle)
Job Task or delivery to perform at a location
Shipment Pickup + delivery pair
ShipmentStep One pickup/delivery step definition
Location Reusable named coordinate reference
Coordinates Coordinate helper payload
Break Agent break windows and duration
Avoid Travel restrictions (e.g., avoid toll roads)

3. Entities (Result Objects)

These classes help interpret and structure the result of the route planner. They are returned by RoutePlannerResult (getAgentPlan(s), getJobPlan(s), getShipmentPlan(s)):

Entity Description
AgentPlan Full plan for an agent: route, actions, timeline
Waypoint Stops where agent performs tasks
RouteAction Actions like pickup, delivery, break
RouteLeg Segment between waypoints
RouteLegStep Low-level step inside a route leg
JobPlan Links a job to an agent and timeline
ShipmentPlan Links a shipment to agent and execution steps

Typical Flow

// 1. Build input
const planner = new RoutePlanner({ apiKey: "YOUR_API_KEY" });
planner
  .setMode("drive")
  .addAgent(new Agent().setStartLocation(...))
  .addJob(new Job().setLocation(...));

// 2. Execute
const result = await planner.plan();

// 3. Explore result
const agents = result.getAgentPlans();
const waypoints = result.getAgentPlan("agent-1")?.getWaypoints() ?? [];

// 4. Modify if needed
const editor = new RoutePlannerResultEditor(result);
await editor.assignJobs("agent-2", ["job-3"]);

UI Integration

  • Use RoutePlannerTimeline to create interactive, embeddable views of agent schedules.
  • Build dashboards, map overlays, or edit tools on top of these components.

Learn More