The Routes API is currently in Preview (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the Google Maps Platform Service Specific Terms. For more information, see the launch stage descriptions.

Configure eco-friendly routes

Stay organized with collections Save and categorize content based on your preferences.

By default, the Routes API returns the default route, meaning a route without factoring in fuel or energy-efficiency. When you enable eco-friendly routing, you still get the default route in the response. In addition, you also get back an eco-friendly route showing the most fuel- or energy-efficient route based on your vehicle's engine type.

The Routes API uses your vehicle's engine type along with other factors such as real-time traffic and road conditions to choose the eco-friendly route. The more fuel or energy-efficient the route, the lower your car's fuel/energy usage and CO2 emissions.

For example, a diesel vehicle's relative fuel economy advantage is generally greatest in highway driving. Hybrid and electric vehicles tend to provide progressively greater efficiency in stop-and-go city driving and hilly driving environments where they can extensively use and benefit from regenerative braking.

The eco-friendly route returned by the API is optimized for lower fuel consumption over the entire route. Use the fuel consumption estimates for the route as a way to compare different routes, not as explicit fuel usage estimates for your exact vehicle.

How Google Maps estimates fuel efficiency

The Routes API estimates fuel-efficiency using insights from the US Department of Energy's National Renewable Energy Laboratory and data from the European Environment Agency. This calculation includes factors that affect your fuel and energy usage and CO2 emissions, such as:

  • Average fuel or energy consumption for vehicles in your region
  • Steepness of hills on your route
  • Stop-and-go traffic patterns
  • Types of roads (such as local roads or highways)

The Routes API returns the most fuel or energy-efficient route when it has roughly the same arrival time as the default route. In cases where fuel or energy savings are too small or increase driving time significantly, the API shows relative fuel or energy savings between routes to help you compare.

Read more about eco-friendly routing technology (PDF).

Prerequisites

To use eco-friendly routing, make a request to compute a route:

  • You must specify TRAFFIC_AWARE_OPTIMAL as the routing preference. In this mode, the server performs a more exhaustive search of the road network to find the optimal route. For more information, see Configure quality vs latency.

  • You must set travelMode to DRIVE. Requests for eco-friendly routes for any other travel mode return an error.

  • You must set a location for the origin waypoint in a supported region. Otherwise, the API returns an error.

  • The route cannot contain an intermediate waypoint.

Request an eco-friendly route

To make a request to compute an eco-friendly route, set the following properties in the request:

  • Set requestedReferenceRoutes to FUEL_EFFICIENT.

  • Specify emissionType for the vehicle using the values defined in VehicleEmissionType: DIESEL, GASOLINE, ELECTRIC, or HYBRID. The default value is GASOLINE.

Also, set a response field mask that specifies to return the response properties associated with an eco-friendly route:

  • routes.routeLabels: Identifies each route:

    • For the default route, the routeLabels array property contains DEFAULT_ROUTE.

    • For the eco-friendly route, the routeLabels array property contains FUEL_EFFICIENT.

    • For any alternate routes, the routeLabels array property contains DEFAULT_ROUTE_ALTERNATE.

  • routes.travelAdvisory.fuelConsumptionMicroliters: Estimated fuel usage for the entire route, in microliters.

    If the emissionType is HYBRID, the API converts electricity and fuel consumption to microliters of fuel.

    If the emissionType is ELECTRIC, the API converts electricity consumption to microliters of fuel.

  • routes.routeToken: A route token that you can pass to the Navigation SDK to retrieve a custom route.

Example eco-friendly request

The following code shows a request for an eco-friendly route. In this example, you use the response field mask to return response properties associated with an eco-friendly route along with the routes.distanceMeters and routes.duration properties:

curl -X POST -H 'content-type: application/json' -d '{
  "origin": {
    "location": {
      "latLng": {
        "latitude": 41.76904801292959,
        "longitude": -72.67374935684933
      }
    }
  },
  "destination": {
    "location": {
      "latLng": {
        "latitude": 41.823042361105024,
        "longitude": -71.40933143059424
      }
    }
  },
  "routeModifiers": {
    "vehicleInfo": {
      "emissionType": "GASOLINE"
    }
  },
  "travelMode":"DRIVE",
  "routingPreference": "TRAFFIC_AWARE_OPTIMAL",
  "requestedReferenceRoutes": ["FUEL_EFFICIENT"]
}' 
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' 
-H 'X-Goog-FieldMask: routes.distanceMeters,routes.duration,routes.routeLabels,routes.travelAdvisory.fuelConsumptionMicroliters,routes.routeToken' 
'https://routes.googleapis.com/directions/v2:computeRoutes'

Example eco-friendly response

The compute route call above generates a JSON response that contains two routes:

{
    "routes": [
        {
            "distanceMeters": 138939,
            "duration": "5412s",
            "travelAdvisory": {
                "fuelConsumptionMicroliters": "10960841"
            },
            "routeToken": "CoYJCpoIC…0n9S1cu",
            "routeLabels": [
                "DEFAULT_ROUTE"
            ]
        },
        {
            "distanceMeters": 116887,
            "duration": "5631s",
            "travelAdvisory": {
                "fuelConsumptionMicroliters": "9302109"
            },
            "routeToken": "CuEHCu0G…xqm",
            "routeLabels": [
                "FUEL_EFFICIENT"
            ]
        }
    ]
}

In the case where the default route and the eco-friendly route are the same, the routeLabels property contains both DEFAULT_ROUTE and FUEL_EFFICIENT:

{
  "routes": [
    {
      "distanceMeters": 45875,
      "duration": "2655s",
      "travelAdvisory": {
        "fuelConsumptionMicroliters": "1926791"
      },
      "routeToken": "CvcDCos…6I40",
      "routeLabels": [
        "DEFAULT_ROUTE",
        "FUEL_EFFICIENT"
      ]
    }
  ]
}

Supported regions

The Google Maps Platform team is constantly working to improve international coverage for our API services. The following list shows the latest coverage details, on a country-by-country basis, for eco-friendly routing:

  • Albania (AL)
  • Austria (AT)
  • Belgium (BE)
  • Bosnia and Herzegovina (BA)
  • Bulgaria (BG)
  • Canada (CA)
  • Croatia (HR)
  • Cyprus (CY)
  • Czechia (CZ)
  • Denmark (DK)
  • Estonia (EE)
  • Finland (FI)
  • France (FR)
  • Germany (DE)
  • Greece (GR)
  • Hungary (HU)
  • Iceland (IS)
  • Ireland (IE)
  • Italy (IT)
  • Kosovo (XK)
  • Latvia (LV)
  • Liechtenstein (LI)
  • Lithuania (LT)
  • Luxembourg (LU)
  • Malta (MT)
  • Montenegro (ME)
  • Netherlands (NL)
  • North Macedonia (MK)
  • Norway (NO)
  • Poland (PL)
  • Portugal (PT)
  • Romania (RO)
  • Serbia (RS)
  • Slovakia (SK)
  • Slovenia (SI)
  • Spain (ES)
  • Sweden (SE)
  • Switzerland (CH)
  • Turkey (TR)
  • United Kingdom (GB)
  • United States (US)