Creates a new Cercalia client instance.
The Cercalia API configuration.
Calculates a route between two points.
Starting coordinate.
Ending coordinate.
Optionaloptions: RoutingOptions & { waypoints?: Coordinate[] }Routing options including vehicle type, weight, and waypoints.
Promise resolving to route result with distance, duration, and geometry.
const routing = new RoutingService(config);
const route = await routing.calculateRoute(
{ lat: 41.3851, lng: 2.1734 }, // Barcelona
{ lat: 40.4168, lng: -3.7038 } // Madrid
);
logger.info(route.distance); // Distance in meters
logger.info(route.duration); // Duration in seconds
logger.info(route.wkt); // WKT geometry of the route
Gets distance and time between two points without full route geometry.
Starting coordinate.
Ending coordinate.
OptionalvehicleType: VehicleTypeOptional vehicle type for routing preferences.
Promise resolving to distance in meters and duration in seconds.
ProtectedrequestExecutes a generic request to the Cercalia API.
Query parameters for the API request.
Human-readable name for logging and debugging.
OptionalbaseUrl: stringOptional override for the base API URL.
A promise resolving to the parsed API response.
Service for calculating routes between coordinates using Cercalia API.
Remarks
Supports multiple vehicle types, optimization criteria, truck restrictions, and waypoint reordering for logistics applications.