> [!WARNING]
> **Notice:** `fromLatLng()` and `fromPlaceId()`
> are deprecated, but will remain available with no further updates. We
> recommend migrating to the new [`Waypoint.Builder`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/Waypoint.Builder).

![](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/side_of_road.png)

By default, the Navigation SDK for Android finds the quickest route to a
waypoint, however this doesn't guarantee that the vehicle will arrive on the
side of the road that the consumer is waiting on or that the arrival place is
safe for the driver to stop at. This guide describes two feature you can use for
these situations:

- **Side of the road routing preference**
- **Stopover feature**

## Side of the road routing preference

You can set a preference for arriving on a particular side of the
road when you create a waypoint for a stop. You can specify the preference
in one of two ways: prefer the same side of the road, or provide an arrival
heading.

### Prefer the same side of the road

You provide the geographic coordinates of the waypoint, and then set a flag
(`setPreferSameSideOfRoad`) that indicates that you prefer to arrive on the same
side of the road as the waypoint---snapped to the nearest sidewalk.

    Waypoint waypoint =
       Waypoint.builder()
               .setLatLng(latitude, longitude)
               .setTitle("Somewhere in Sydney")
               .setPreferSameSideOfRoad(true)
               .build()

> [!IMPORTANT]
> **Key Point:** In some situations, when the waypoint is snapped to the side of the nearest road, the nearest road might not be the right one. For example, it might be a road around the corner from the waiting consumer. You can prevent this from occurring by using `setPreferredHeading` instead of `setPreferSameSideOfRoad` (see the next section for details).

### Set an arrival heading

You provide the geographic coordinates of the waypoint, and then provide an
arrival heading (`setPreferredHeading`) that matches the direction of
traffic flow on the same side of the road as the waiting consumer.

    Waypoint waypoint =
       Waypoint.builder()
               .setLatLng(latitude, longitude)
               .setTitle("Somewhere in Sydney")
               .setPreferredHeading(preferredHeading)
               .build()

The Navigation SDK chooses the road segment closest to the
waypoint---that has a lane direction that aligns (within +/- 55 degrees) with the
side of the road that the waypoint is on.

## Set stopover preference

In certain places, it's not possible for drivers to stop safely (for example,
elevated areas, ferries, underground locations, and other areas of limited
access). The **Stopover** feature relocates the waypoint to a nearby place if
its location is not suitable for a vehicle to make a stop. When you set
`setVehicleStopover` to `true`, the waypoint is automatically relocated when
the route is calculated, if an alternate location is available.

### How it works

You set the preference for a stopover when creating the waypoint for that stop.
To do this, specify the `setVehicleStopover` preference as shown in the
following example:

    Waypoint waypoint =
       Waypoint.builder()
               .setLatLng(latitude, longitude)
               .setTitle("Somewhere in Sydney")
               .setVehicleStopover(true)
               .build()