Data-processing
Prepare travel data - build the travel-cost matrix (durations and distances between your locations) that a problem needs.
Calculate a cost matrix for the given locations
Calculate a cost matrix for the given locations and travel costs. This is useful for calculating travel durations and distances between locations.
Calculate a cost matrix for the given locations › Request Body
The locations to use for calculating the cost matrix.
costSettingsThe settings to use for calculating travel costs between locations. This includes the cost metric (duration or distance), cost multiplier, cost adder, and methods for calculating distances and durations.
The travel costs to use for calculating the cost matrix. If not provided, the cost matrix will be calculated automatically based on the latitude and longitude of the locations. A partial cost matrix can be provided to avoid recalculating travel durations and distances between locations.
coordinateSystemWhich coordinate family this problem's locations use. geographic (the default, and what every existing payload means) uses latitude/longitude on the Earth. cartesian uses unbounded x/y on an arbitrary plane, for scenarios with positions but no addresses. It describes the DATA, not the costing, so it is set once per request rather than per cost setting - and it decides which distance/duration methods are valid.
Calculate a cost matrix for the given locations › Responses
Cost matrix calculated. data.travelCostResponses holds one entry per location pair (duration, distance, and cost); data.travelCostErrors lists any pairs that could not be computed. This array drops straight into a solve: set problemData.travelCosts to data.travelCostResponses on your POST /problem request.
Make sure durations come back populated. With the defaults (no travelCosts supplied → autoCalculate* true, geo) every pair is computed. The trap is a matrix whose durations are null: the solver reads a null duration as an unreachable arc. You can produce that by sending autoCalculateDuration: false (or otherwise leaving durations empty). If that leaves no usable pair in the whole matrix, POST /problem rejects it with 400 UNCOSTED_TRAVEL_MATRIX (its 400 response says what counts as usable). If only some pairs are empty, /problem accepts the matrix and returns a succeeded run with the stops behind those pairs left unassigned and no error. An all-zero matrix is not the same thing — it solves fine, with every stop assigned and 0 total distance. (An absent/empty matrix at /problem is rejected outright with MISSING_TRAVEL_COSTS.) So confirm the returned duration values are populated before solving, and read the assigned count in the results.
successThe response schema for a cost matrix calculation request. This includes the travel costs and any errors encountered during the calculation.
