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

diff
- 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_KEY

Check these differences first

  • Coordinates only. Addresses and place_id: values aren't accepted — geocode first.
  • Driving only, and no live traffic (duration_in_traffic is not returned).
  • origin_addresses echo your coordinates instead of formatted addresses.

The migration guide has the full field-by-field table.

Roll out safely

  1. Shadow: for a sample of production requests, call both and log the difference without using the new result.
  2. Review: look at the distribution of distance and duration differences on your routes.
  3. Canary: switch 5% of traffic; watch error rates and support tickets.
  4. Cut over, then move the key from the query string to an Authorization: Bearer header.

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.

MigrationGoogle MapsDistance matrix

Start building in minutes

Create an account, grab a test key and make your first request in under five minutes.