يتيح لك الموقع الجغرافي أيضًا تحديد الاتجاه الذي تريد أن تتّخذه المركبة عند وصولها إلى كل نقطة طريق. يمكنك استخدام هذه الميزة لضمان وصول المركبة إلى الجانب نفسه من الطريق الذي ينتظر فيه المستهلك. عند عدم تحديد اتجاه، قد تصل المركبة إلى الجانب الخاطئ من الطريق.
قيم العنوان هي أعداد صحيحة تتوافق مع اتجاهات البوصلة، وبالتالي تتراوح بين صفر و359. على سبيل المثال، تشير القيمة 0 إلى اتجاه العنوان شمالًا.
يمكنك تمثيل موقع جغرافي من خلال إنشاء عنصر Waypoint
(REST) أو Waypoint (gRPC). يمكن أن يتطابق الموقع الجغرافي المحدّد بزوج من خطوط الطول والعرض مع جانب معيّن من الطريق. ومع ذلك، لدعم ميزة تحسين المسار، يمكن أن يضبط المسار نقطة توقّف على الجانب الآخر من الطريق من الموقع الجغرافي المحدّد.
تتيح نقاط الطريق استخدام السمة sideOfRoad، التي تشير إلى أنّ الموقع الجغرافي لنقطة الطريق يفضّل أن تتوقف المركبة على الجانب نفسه من الطريق كما هو محدّد في الموقع الجغرافي.
حدِّد أنّ المسار يستخدم الجانب المفضّل من الطريق من خلال ضبط قيمة السمة Waypoint sideOfRoad على true. بعد ذلك، يمرّ المسار بالموقع الجغرافي لكي تتمكّن المركبة من التوقّف على جانب الطريق الذي يقع فيه الموقع الجغرافي.
يوضّح المثال التالي كيفية ضبط sideOfRoad لنقطة طريق.
تاريخ التعديل الأخير: 2025-07-22 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-22 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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```"]]