Places UI Kit: A ready-to-use library that provides room for customization and low-code development. Try it out, and share yourinput on your UI Kit experience.

Specify vehicle heading and side of road

European Economic Area (EEA) developers If your billing address is in the European Economic Area, effective on 8 July 2025, the Google Maps Platform EEA Terms of Service will apply to your use of the Services. Functionality varies by region.Learn more.

Waypoints may include location modifiers to change how routes are calculated, including settings forheading andsideOfRoad.

Note:heading andsideOfRoad are mutually exclusive properties. You cannot use them together for the same location.Caution: Requests usingheading andsideOfRoad are billed at a higher rate.Learn more about billing for Routes API.

Specify the vehicle heading

To define a waypoint, specify the geographic location using latitude/longitude coordinates. You can also specify the direction you want the vehicle to head when it arrives at each waypoint. Use this feature to ensure that the vehicle arrives on the same side of the road as the consumer waiting to be picked up. When a heading is not specified, the vehicle can arrive on the wrong side of the road.

Heading values are numbers that align with the compass directions, and therefore range from zero to 359. For example, a value of 0 indicates a heading direction of due North.

Note: You can set heading only when using either theDRIVING orTWO_WHEELER travel modes, AND when specifying the location by using a latitude and longitude pair.
// Mountain View, CAconstoriginLatLng={lat:37.422000,lng:-122.084058};// San Francisco, CAconstdestinationLatLng={lat:37.774929,lng:-122.419415};// Half Moon Bay, CAconstviaLatLng={lat:37.450733,lng:-122.430281,heading:330};// Define a computeRoutes request.constrequestWithLatLngs={origin:originLatLng,destination:destinationLatLng,intermediates:[{location:viaLatLng}],fields:['path'],};

Specify a the side of road preference

A location defined by a latitude and longitude pair can correspond to a specific side of a road. However, to support route optimization, a route can still set a stopover to be on the opposite side of the road from the specified location.

Waypoints support thesideOfRoad property, which indicates that the waypoint location has a preference for the vehicle to stop at the same side of road as specified by the location.

Specify that the route uses the preferred side of the road by setting thesideOfRoad property totrue. The route then passes through the location so that the vehicle can stop at the side of road that the location is biased towards.

Note: You can setsideOfRoad only when using either theDRIVING orTWO_WHEELER travel modes, AND when specifying the location by using a latitude and longitude pair.

The following example shows how to setsideOfRoad for a waypoint:

constsideOfRoadLatLng={location:{lat:37.450733,lng:-122.430281,},sideOfRoad:true,};

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-31 UTC.