Distance Matrix Integration
The VRP solver integrates with Solvice Maps to generate distance matrices before optimization, so routes are based on real travel times and distances instead of straight-line estimates.Why It Matters
Without real distance data, the solver falls back to euclidean (straight-line) distances with no traffic or route restrictions — which can produce routes that look optimal on paper but aren’t actually drivable.How It Works
Before solving, the VRP solver collects every unique job and resource location from your request and fetches a distance matrix for them from Solvice Maps, then uses the resulting durations and distances during optimization. Request splitting for large location sets and vehicle-category mapping are handled automatically.Available Routing Options
Euclidean vs Real Road Networks
- Euclidean Distance
- Real Road Networks
Routing Engine Selection
- OSM: OpenStreetMap data, global coverage, no traffic awareness
- TOMTOM: Commercial routing with traffic data for enhanced accuracy
- TOMTOM_REAL_TIME: TomTom routing on live traffic conditions - see Live traffic
Custom Distance Matrices
Instead of letting the VRP solver compute a distance matrix for you, you can supply your own pre-computed matrix and have the solver use it as-is. This is useful when:- You’ve already generated a matrix for a recurring set of locations and want to skip recomputing it on every request
- You need routing constraints that aren’t achievable through
routingEngineand vehiclecategoryalone - Matrix generation time is a significant part of your total solve time and you want to remove it from the critical path
The customDistanceMatrices Field
object
Maps a vehicle profile name (matching a resource’s
category, e.g. CAR, BIKE, TRUCK) to a set of time-slice-hour → matrix ID pairs. The matrix ID must reference a table that has already finished computing.string
Optional URL for an external distance matrix service endpoint. If omitted, the default system service is used.
Time Slice Hours
When
routingEngine is OSM (the default), the solver only fetches the NIGHT slice ("20") — a single matrix ID per profile is enough. Traffic-aware engines (TOMTOM, ANYMAP) can use a different matrix per slice to cover the full day.Generating a Matrix ID
Matrix IDs come from Solvice Maps’ Matrix endpoint, not from the VRP API itself:1
Request a table
id with "status": "IN_PROGRESS".2
Poll until it's ready
"status" becomes "SUCCEEDED".3
Reference the ID in your VRP request
Use that same
id as the matrix ID in customDistanceMatrices.profileMatrices.Full Example
Traffic Multiplier
1.2 = +20%) — a simple approximation when you don’t have per-route traffic data. For real time-of-day traffic, use routingEngine: "TOMTOM", or supply your own time-sliced data via Custom Distance Matrices.
Live traffic
TOMTOM predicts travel times from historical patterns for the departureTime you supply. TOMTOM_REAL_TIME instead uses traffic conditions at the moment of the request:
TOMTOM with a departureTime — TOMTOM_REAL_TIME ignores departureTime and always routes on the current time.
Requests are limited to 49 unique locations. Jobs, resource start and end locations, shift start and end locations, unavailability break locations, and depots all count toward that total, and locations sharing coordinates count once. Exceeding the limit returns a 400.
Vehicle Categories
category determines which routing profile is used when generating its distance matrix.
Performance
Error Handling
If the routing engine is unavailable, the solver falls back to euclidean distances rather than failing the request, and reports this via the response’smessages field.
Best Practices
- Use real road networks (
euclidian: false) in production - Use
routingEngine: "TOMTOM"for time-critical, traffic-sensitive routing - Validate a known route’s distance/duration against ground truth before trusting a new routing engine or custom matrix
Related Topics
Basic Routing Example
See distance matrices in practice
Performance Guide
Optimize solving performance
Advanced Time Features
Time-dependent routing capabilities
Constraint System
How constraints use distance data