1.3 KiB
1.3 KiB
Directions
Use the Routes API (computeRoutes) to get distance, duration, and step-by-step instructions.
Enable the API
- Enable Routes API in Google Cloud Console for the same project as Places.
- Use the same
GOOGLE_PLACES_API_KEY(recommended).
Examples
Walking summary:
goplaces directions --from "Pike Place Market" --to "Space Needle"
Place ID driven:
goplaces directions --from-place-id <fromId> --to-place-id <toId>
Walking with driving comparison + steps:
goplaces directions --from-place-id <fromId> --to-place-id <toId> --compare drive --steps
Imperial units:
goplaces directions --from-place-id <fromId> --to-place-id <toId> --units imperial
Driving route modifiers:
goplaces directions --from "Paris" --to "Brest" --mode drive --avoid-tolls
goplaces directions --from "Paris" --to "Brest" --mode drive --avoid-highways --avoid-ferries
Notes
- Default mode is walking.
- Default units are metric (use
--units imperialfor miles/feet). - Use
--stepsfor turn-by-turn instructions. - Use
--compare driveto add a driving ETA. - Use
--avoid-tolls,--avoid-highways, and--avoid-ferrieswith--mode driveto request drive routes that avoid those features when reasonable.