Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Développeurs de l'Espace économique européen (EEE)
Les points de cheminement peuvent inclure des modificateurs de localisation pour modifier le calcul des itinéraires, y compris les paramètres pour heading et sideOfRoad.
Spécifier le cap du véhicule
Pour définir un point de cheminement, vous devez spécifier l'emplacement géographique (REST) ou l'emplacement (gRPC) sous forme de paire de coordonnées de latitude et de longitude.
L'emplacement vous permet également de spécifier la direction que le véhicule doit prendre lorsqu'il arrive à chaque point de cheminement. Cette fonctionnalité permet de s'assurer que le véhicule arrive du même côté de la route que le client qui attend d'être récupéré. Si vous ne spécifiez pas de cap, le véhicule peut arriver du mauvais côté de la route.
Les valeurs d'en-tête sont des nombres entiers qui correspondent aux directions de la boussole et sont donc comprises entre 0 et 359. Par exemple, une valeur de 0 indique une direction de cap plein nord.
L'exemple suivant montre comment définir un heading pour un point de cheminement.
Pour représenter un lieu, vous devez créer un objet Waypoint (REST) ou Waypoint (gRPC). Une zone géographique définie par une paire de latitude et de longitude peut correspondre à un côté spécifique d'une route. Toutefois, pour prendre en charge l'optimisation des itinéraires, un itinéraire peut toujours définir une étape sur le côté opposé de la route par rapport à l'emplacement spécifié.
Les points de cheminement sont compatibles avec la propriété sideOfRoad, qui indique que le véhicule doit s'arrêter du même côté de la route que celui spécifié par l'emplacement.
Spécifiez que l'itinéraire utilise le côté préféré de la route en définissant la propriété sideOfRoad du point de repère sur true. L'itinéraire passe ensuite par le lieu afin que le véhicule puisse s'arrêter du côté de la route vers lequel le lieu est orienté.
L'exemple suivant montre comment définir sideOfRoad pour un point de repère.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/22 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/22 (UTC)."],[[["\u003cp\u003eWaypoints can include \u003ccode\u003eheading\u003c/code\u003e and \u003ccode\u003esideOfRoad\u003c/code\u003e modifiers to influence route calculation, but these options cannot be used together for the same location and incur higher billing rates.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eheading\u003c/code\u003e specifies the vehicle's direction (0-359 degrees) upon arrival at a waypoint, ensuring it approaches from the desired side of the road, and is applicable to \u003ccode\u003eDrive\u003c/code\u003e or \u003ccode\u003eTwo-wheeler\u003c/code\u003e travel modes using latitude/longitude coordinates.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esideOfRoad\u003c/code\u003e, when set to \u003ccode\u003etrue\u003c/code\u003e, indicates a preference for the vehicle to stop on the same side of the road as the specified location, also applicable to \u003ccode\u003eDrive\u003c/code\u003e or \u003ccode\u003eTwo-wheeler\u003c/code\u003e travel modes.\u003c/p\u003e\n"]]],["Waypoints can include location modifiers like `heading` and `sideOfRoad` to influence route calculations. `Heading`, a 0-359 compass direction value, specifies the vehicle's arrival direction. `sideOfRoad` indicates a preference for the vehicle to stop on the same side of the road as the specified location. Both modifiers are only available for `Drive` or `Two-wheeler` modes and when using latitude/longitude pairs. `Heading` and `sideOfRoad` are incompatible. Using these modifiers will result in a higher billing rate.\n"],null,["# Specify vehicle heading and side of road\n\n**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](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nWaypoints may include location modifiers to change how routes are calculated,\nincluding settings for `heading` and `sideOfRoad`.\n| **Note:** `heading` and `sideOfRoad` are incompatible. You may not use them for the same location.\n| **Caution:** Requests using `heading` and `sideOfRoad` are billed at a higher rate. [Learn more about billing](/maps/documentation/routes/usage-and-billing) for Routes API.\n\nSpecify the vehicle heading\n---------------------------\n\nTo define a waypoint, you specify the geographic\n[Location](/maps/documentation/routes/reference/rest/v2/Location) (REST) or\n[Location](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#location) (gRPC)\nas a pair of latitude/longitude coordinates.\n\nLocation also lets you specify the direction you want the vehicle to head when\nit arrives at each waypoint. You can use this feature to ensures that the\nvehicle arrives on the same side of the road as the consumer waiting to be\npicked up. When you don't specify a heading, the vehicle can arrive on the\nwrong side of the road.\n| **Note:** You can set `heading` only when using either the `Drive` or `Two-wheeler` travel modes, and when specifying the location by using a latitude and longitude pair.\n\nHeading values are whole numbers that align with the compass directions, and\ntherefore range from zero to 359. For example, a value of 0 indicates a heading\ndirection of due North.\n\nThe following example demonstrates how to set a\n[`heading`](/maps/documentation/routes/reference/rest/v2/Location) for a waypoint. \n\n```text\n{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.419734,\n \"longitude\": -122.0827784\n },\n \"heading\": 127\n }\n },\n ...\n```\n\nSpecify a side of the road preference\n-------------------------------------\n\nYou represent a location by creating a [Waypoint](/maps/documentation/routes/reference/rest/v2/Waypoint)\n(REST) or [Waypoint](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#waypoint) (gRPC)\nobject. A location defined by a latitude and longitude pair can correspond to a\nspecific side of a road. However, to support route optimization, a route can\nstill set a stopover to be on the opposite side of the road from the specified\nlocation.\n\nWaypoints support the [`sideOfRoad`](/maps/documentation/routes/reference/rest/v2/Waypoint) property, which\nindicates that the waypoint location has a preference for the vehicle to stop at\nthe same side of road as specified by the location.\n\nSpecify that the route uses the preferred side of the road by setting the\nWaypoint `sideOfRoad` property to `true`. The route then passes through the\nlocation so that the vehicle can stop at the side of road that the location is\nbiased towards.\n| **Note:** You can set the `sideOfRoad` only when using either the `Drive` or `Two-wheeler` travel modes.\n\nThe following example shows how to set `sideOfRoad` for a waypoint. \n\n```text\n{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.419734,\n \"longitude\": -122.0827784\n }\n },\n \"sideOfRoad\": true\n },\n ...\n```"]]