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.

Set a point for a route to pass through

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.

By default, intermediate waypoints are used for stopping for pickups and dropoffs, but you can also specify that an intermediate waypoint is meant just to pass through.

A route that contains an origin waypoint, a pass-through intermediate waypoint, and a destination waypoint contains just one route leg that connects the origin and the destination, while passing through the intermediate (called avia) waypoint.

Configure an intermediate waypoint to be a pass-through waypoint by setting thevia property of the waypoint totrue using theWaypoint interface.

Thevia property is most effective when creating routes in response to the user dragging the waypoints on the map. Doing so allows the user to see how the final route may look in real-time and helps ensure that waypoints are placed in locations that are accessible to the Routes library.

Caution: Using thevia field to avoid stopovers results in routes that are strict in their interpretation of the waypoint. This interpretation may result in severe detours on the route orZERO_RESULTS in the response status code if the Maps JavaScript API is unable to create a route through that point.

Example request

The following example request demonstrates how to mark an intermediate waypoint as a pass-through waypoint.

constrouteRequestWithVia={origin:'100 Moffett Blvd, Mountain View, CA 94043',destination:'1199 9th Ave, San Francisco, CA 94122',travelMode:'DRIVING',intermediates:[{location:'Half Moon Bay, CA',via:true}// Set the via property to true],fields:['path','legs'],};// Make the request.const{routes,fallbackInfo,geocodingResults}=awaitRoute.computeRoutes(routeRequestWithIntermediates);

Access place IDs for intermediate waypoints

If you specify the location of an origin, destination, or intermediate waypoint as anaddress string or as aPlus code, the Routes library attempts to find the most relevant location which has a corresponding place ID. ThegeocodingResults.intermediates array in the results contains the place ID corresponding to the location of the waypoints, along with additional data about the location.

Note: If a waypoint is specified as a place ID or as latitude/longitude coordinates, it is omitted from the place ID lookup results.

Example geocoding results response

{"origin":{"geocoderStatus":"OK","types":["premise","street_address"],"partialMatch":false,"placeId":"ChIJb5NgcTa3j4ARrfF4Oc_f6q8","intermediateWaypointRequestIndex":null},"destination":{"geocoderStatus":"OK","types":["premise","street_address"],"partialMatch":false,"placeId":"ChIJAbIPLl2HhYARQ0SSdDFxU-s","intermediateWaypointRequestIndex":null},"intermediates":[{"geocoderStatus":"OK","types":["locality","political"],"partialMatch":false,"placeId":"ChIJC8sZCqULj4ARVJvnNcic_V4","intermediateWaypointRequestIndex":0}]}

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.