Migrating from the Google Distance Matrix API without rewriting your parser
Move a Google Distance Matrix integration to a compatible endpoint by changing the base URL — plus a shadow-traffic rollout plan and the differences to check.
By Wayline Engineering · · Updated · 1 min read
If your app already sends coordinates to the Google Distance Matrix API, switching providers doesn't have to mean rewriting the code that parses rows[].elements[]. Wayline's compatible endpoint returns the same JSON structure.
The change
- https://maps.googleapis.com/maps/api/distancematrix/json?origins=…&destinations=…&key=GOOGLE_KEY
+ https://api.wayline.cloud/maps/api/distancematrix/json?origins=…&destinations=…&key=WAYLINE_KEYCheck these differences first
- Coordinates only. Addresses and
place_id:values aren't accepted — geocode first. - Driving only, and no live traffic (
duration_in_trafficis not returned). origin_addressesecho your coordinates instead of formatted addresses.
The migration guide has the full field-by-field table.
Roll out safely
- Shadow: for a sample of production requests, call both and log the difference without using the new result.
- Review: look at the distribution of distance and duration differences on your routes.
- Canary: switch 5% of traffic; watch error rates and support tickets.
- Cut over, then move the key from the query string to an
Authorization: Bearerheader.
Check each provider's terms about storing and comparing results before you shadow traffic.
Then go native (optional)
The native matrix endpoint adds snapped locations, region, map version and units_charged, and accepts JSON bodies — migrate when it's convenient.