Directions
Description: Provides navigation and route information between locations.
API Response Structure:
{
"route": {
"origin": {
"address": "Start Address",
"coordinates": {
"lat": 40.7128,
"lng": -74.0060
}
},
"destination": {
"address": "End Address",
"coordinates": {
"lat": 40.7589,
"lng": -73.9851
}
},
"summary": {
"distance": "4.2 miles",
"duration": "15 mins",
"mode": "Driving"
}
},
"steps": [
{
"instruction": "Turn right on Main St",
"distance": "0.5 miles",
"duration": "2 mins",
"maneuver": "turn-right",
"landmarks": ["Gas station", "Bank"],
"trafficInfo": "Light traffic"
}
],
"alternatives": [
{
"summary": {
"distance": "4.5 miles",
"duration": "18 mins",
"description": "Alternate route via Highway"
}
}
],
"transportation": {
"modes": ["Driving", "Transit", "Walking"],
"transitOptions": {
"departureTime": "10:00 AM",
"routes": ["Bus 123", "Subway A"]
}
},
"type": "directions"
}
Fields:
-
route
(object): Route information-
origin
(object): Start point -
destination
(object): End point -
summary
(object): Route overview
-
-
steps
(array): Navigation instructions -
alternatives
(array): Other routes -
transportation
(object): Travel options -
type
(string): Always "directions"