**European Economic Area (EEA) developers**

> [!NOTE]
> If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](https://developers.google.com/maps/comms/eea/faq.md.txt).

To calculate a route matrix, you must specify at a minimum the
locations of one route origin and one route destination.

## Specify locations for a route

You represent a location by creating a [Waypoint (REST)](https://developers.google.com/maps/documentation/routes/reference/rest/v2/Waypoint.md.txt)
or [Waypoint (gRPC)](https://developers.google.com/maps/documentation/routes/reference/rpc/google.maps.routing.v2.md.txt#waypoint) object. In the
waypoint definition, you can specify a location in any of the following ways:

- [Place ID](https://developers.google.com/maps/documentation/routes/specify_location-rm.md.txt#place_id) (preferred)
- [Latitude/longitude coordinates](https://developers.google.com/maps/documentation/routes/specify_location-rm.md.txt#lat_long)
- [Address string](https://developers.google.com/maps/documentation/routes/specify_location-rm.md.txt#text_string) ("Chicago, IL" or "Darwin, NT, Australia")
- [Navigation point token](https://developers.google.com/maps/documentation/routes/specify_location-rm.md.txt#navigation_point_token)
- [Plus Code](https://developers.google.com/maps/documentation/routes/specify_location-rm.md.txt#plus_code)

You can specify locations for all waypoints in a request the same way,
or you can mix them. For example, you can use latitude/longitude coordinates for
the origin waypoint and use a place ID for the destination waypoint.

For efficiency and accuracy, use place IDs instead of latitude/longitude
coordinates or address strings. Place IDs are uniquely explicit and provide
geocoding benefits for routing such as access points and traffic variables. They
help avoid the following situations that can result from other ways of
specifying a location:

- Using latitude/longitude coordinates can result in the location being snapped to the road nearest to those coordinates - which might not be an access point to the property, or even a road that quickly or safely leads to the destination.
- Address strings must first be geocoded by the Routes API to convert them to latitude/longitude coordinates before it can calculate a route. This conversion can affect performance.

### Specify a location as a place ID

You can use a place ID to specify the location of a waypoint. Because
latitude and longitude coordinates are snapped to roads, you might find a
place ID offers better results in some circumstances.

Retrieve place IDs from the [Geocoding API](https://developers.google.com/maps/documentation/geocoding) and
the [Places API (New)](https://developers.google.com/maps/documentation/places/web-) (including Autocomplete (New)). For more about place IDs, see the
[Place ID overview](https://developers.google.com/maps/documentation/places/web-service/place-id.md.txt).

The following example uses the `placeId` property to pass a place ID for both
the `origin` and `destination`:

```json
{
  "origin":{
    "placeId": "ChIJayOTViHY5okRRoq2kGnGg8o"
  },
  "destination":{
    "placeId": "ChIJTYKK2G3X5okRgP7BZvPQ2FU"
  },
  ...
}
```

### Specify a location as latitude and longitude coordinates

To define location in a waypoint, specify the
[Location (REST)](https://developers.google.com/maps/documentation/routes/reference/rest/v2/Location.md.txt) or
[Location (gRPC)](https://developers.google.com/maps/documentation/routes/reference/rpc/google.maps.routing.v2.md.txt#location) by using
latitude/longitude coordinates.

For example, specify a waypoint for the route `origin` and `destination`
using `latitude` and `longitude` coordinates:

```json
{
  "origin":{
    "location":{
      "latLng":{
        "latitude": 37.419734,
        "longitude": -122.0827784
      }
    }
  },
  "destination":{
    "location":{
      "latLng":{
        "latitude": 37.417670,
        "longitude": -122.079595
      }
    }
  },
...
}
```

> [!NOTE]
> **Note:** The points specified by latitude/longitude coordinates are snapped to roads and might not provide the accuracy your app needs. Use latitude/longitude coordinates when you are confident the values truly specify the points your app needs for routing without regard to possible access points or additional geocoding details.

### Specify a location as an address string

Address strings are literal addresses represented by a string (such as "1600
Amphitheatre Parkway, Mountain View, CA"). Geocoding is the process of
converting an address string into latitudes and longitude coordinates (such as
latitude 37.423021 and longitude -122.083739).

When you pass an address string as the location of a waypoint, Routes API
internally geocodes the string to convert it to latitude and longitude
coordinates.

> [!NOTE]
> **Note:** The latitude and longitude coordinates might be different from those returned by the [Geocoding API](https://developers.google.com/maps/documentation/geocoding). For example, Routes API might return coordinates for a building entrance rather than for its center.

For example, to calculate a route you specify a waypoint for the route `origin` and
`destination` using address strings:

```json
{
  "origin":{
    "address": "1600 Amphitheatre Parkway, Mountain View, CA"
  },
  "destination":{
    "address": "450 Serra Mall, Stanford, CA 94305, USA"
  },
  ...
}
```

In this example, the Routes API geocodes both addresses to convert them to
latitude and longitude coordinates.

If the address value is ambiguous, the Routes API might invoke a search to
disambiguate from similar addresses. For example, "1st Street" could be a
complete value or a partial value for "1st street NE" or "1st St SE". This
result may be different from that returned by the Geocoding API. You can avoid
possible misinterpretations using place IDs.

#### Set the region for the address

If you pass an incomplete address string as the location of a waypoint, the API
might use the wrong geocoded latitude/longitude coordinates. For example,
you make a request specifying "Toledo" as the origin and "Madrid" as the
destination for a driving route:

```json
{
  "origin":{
    "address": "Toledo"
  },
  "destination":{
    "address": "Madrid"
  },
  "travelMode": "DRIVE"
}
```

In this example, "Toledo" is interpreted as a city in the state of
Ohio in the United States, not in Spain. Therefore, the request returns
an empty array, meaning no routes exists:

```json
{
  []
}
```

You can configure the API to return results biased to a particular region by
including the `regionCode` parameter. This parameter specifies the region code as a
[ccTLD ("top-level domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains)
two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with
some notable exceptions. For example, the United Kingdom's ccTLD is "uk"
(.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The
United Kingdom of Great Britain and Northern Ireland").

A directions request for "Toledo" to "Madrid" that includes the `regionCode`
parameter returns appropriate results because "Toledo" is interpreted as a
city in Spain:

```json
{
  "origin":{
    "address": "Toledo"
  },
  "destination":{
    "address": "Madrid"
  },
  "travelMode": "DRIVE",
  "regionCode": "es"
}
```

The response now contains the route calculated from Toledo, Spain to
Madrid, Spain:

```json
{
  "routes": [
    {
      "distanceMeters": 75330,
      "duration": "4137s",
      ...
    }
  ]
}
```

### Specify a location as a navigation point token

> [!WARNING]
> This product or feature is 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](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage
> descriptions](https://developers.google.com/maps/launch-stages).

A navigation point token is a string that encodes a location and additional route context. Navigation point tokens can provide precise routing to specific access points near entrances, loading docks, or designated pick-up areas. This is useful in cases like food delivery or
rideshare, where the pickup or dropoff point may be ambiguous.

You can obtain a navigation point token by calling the Destinations method of the [Geocoding API](https://developers.google.com/maps/documentation/geocoding).


To specify a navigation point token:

1. Obtain a `navigationPointToken` from the `SearchDestinations` method of the [Geocoding API](https://developers.google.com/maps/documentation/geocoding). [See the Geocoding API documentation for more information.](https://developers.google.com/maps/documentation/geocoding/navigation-point-tokens.md.txt)
2. Create a Waypoint by passing in the `navigationPointToken`.

The following example uses the `navigation_point_token` property to pass a navigation point token for both the `origin` and `destination`:

```json
{
  "origin":{
    "navigation_point_token": "ENCODED_NAVIGATION_POINT_TOKEN_FOR_ORIGIN"
  },
  "destination":{
    "navigation_point_token": "ENCODED_NAVIGATION_POINT_TOKEN_FOR_DESTINATION"
  },
  ...
}
```

### Specify a location as a Plus Code

Many people don't have a precise address, which can make it difficult for them
to receive deliveries. Or, people with an address might prefer to accept
deliveries at more specific locations, such as a back entrance or a loading
dock.

Plus Codes are like street addresses for people or places that don't have an
actual address. Instead of addresses with street names and numbers, Plus Codes
are based on latitude/longitude coordinates, and are displayed as numbers and
letters.

Google developed [Plus Codes](https://maps.google.com/pluscodes/)
to give the benefit of addresses to everyone and everything. A Plus Code is an encoded
location reference, derived from latitude/longitude coordinates, that
represents an area: 1/8000th of a degree by 1/8000th of a degree (about 14m x
14m at the equator) or smaller. You can use Plus Codes as a replacement for
street addresses in places where they don't exist or where buildings are not
numbered or streets are not named.

Plus Codes must be formatted as a global code or a compound code:

- A **global code** is composed of a 4 character **area code** and 6 character or longer **local code** .

  For example, for the address "1600 Amphitheatre Parkway,
  Mountain View, CA", the global code is "849V" and the local code is
  "CWC8+R9". You then use the entire 10 character Plus Code to specify the
  location value as "849VCWC8+R9".
- A **compound code** is composed of a 6 character or longer **local code** combined with an explicit location.

  For example, the address "450 Serra
  Mall, Stanford, CA 94305, USA" has a local code of "CRHJ+C3". For a compound
  address, combine the local code with the city, state, ZIP code, and country
  portion of the address in the form "CRHJ+C3 Stanford, CA 94305, USA".

  For example, calculate a route by specifying a waypoint for the route `origin`
  and `destination` using Plus Codes:

  ```json
  {
    "origin":{
      "address": "849VCWC8+R9"
    },
    "destination":{
      "address": "CRHJ+C3 Stanford, CA 94305, USA"
    },
    "travelMode": "DRIVE"
  }
  ```

Plus Codes are supported in Google Maps Platform APIs including
[Autocomplete (New)](https://developers.google.com/maps/documentation/places/web-service/place-autocomplete.md.txt),
[Place Details (New)](https://developers.google.com/maps/documentation/places/web-service/place-details.md.txt), and
[Geocoding API](https://developers.google.com/maps/documentation/geocoding).
For example, you can use Geocoding API to reverse geocoding a
location specified by latitude/longitude coordinates to determine the
location's Plus Code.