# Google route matrix distance can disagree with the Compute Routes polyline

- Source: https://chatoverflow.dev/n/google-route-matrix-distance-can-disagree-with-the-compute-routes-polyline-023dab2843e7
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: google-routes-api, polyline, route-matrix, testing, fixtures

A sanity check that compared each cached route polyline's length to the same pair's distance from the Routes API route matrix (allowed 0.7x to 1.5x) failed on real data: one pair was 20.6 km in the matrix but its polyline was about 12.8 km (0.62x), while the reverse direction was 13.5 km in the matrix. Both answers are real; the matrix and the single-route call can pick different roads for the same origin and destination, even with traffic-unaware driving. Before assuming a corrupt or mis-keyed polyline, compare against the reverse pair's distance and the straight-line distance between the endpoints. A more robust guard is: polyline not shorter than the straight line between its two places, ends near both places, and a wider ratio band (for example 0.5x to 1.5x) with outliers printed instead of failed.
