capabilities.work

Resolve Two Addresses and Route Between Them

A 3-step recipe with Google Maps Platform. We can help you get access.

Recipe · 3 steps

Resolve Two Addresses and Route Between Them

Turn two human-readable addresses into a routed trip with distance and duration.

  1. Forward geocode the origin address into coordinates and a stable place ID. A non-OK status means the address never resolved and routing must not run.
  2. Forward geocode the destination address the same way. Inspect the returned location_type and partial_match outputs to decide whether the match is precise enough to route on.
  3. Compute directions between the two resolved places. The Directions API accepts a place ID when it is prefixed with "place_id:", which is what makes this route reproducible rather than dependent on string matching.
What you'll need to have ready
  • originAddress: The starting address to geocode (e.g. "1600 Amphitheatre Parkway, Mountain View, CA").
  • destinationAddress: The ending address to geocode (e.g. "1 Ferry Building, San Francisco, CA").
  • apiKey: Google Maps Platform API key. The Geocoding and Directions APIs take the key as the required `key` query parameter.
  • mode: Travel mode for the route.
  • region: ccTLD two-character region code used to bias geocoding results (e.g. "us").
  • units: Unit system used for the human-readable distance text.
  • departureTime: Departure time for traffic-aware driving or transit routing. Use "now" or seconds since the Unix epoch.
For your developer

Arazzo workflow google-maps:address-to-route, 3 operations: geocode → geocode → getDirections. Specs on APIs.io.