Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Разработчики Европейской экономической зоны (ЕЭЗ)
При расчёте матрицы маршрутов может потребоваться учесть любые сборы за проезд по маршрутам, включённым в матрицу. Для некоторых городов можно рассчитать предполагаемую стоимость проезда по маршруту в соответствующей валюте.
Список поддерживаемых пунктов взимания платы см. в справке по TollPass .
Пример матрицы маршрута с оплатой пошлины
В следующем примере метод computeRouteMatrix используется для возврата информации о платном проезде по маршруту с расчетной ценой при использовании платного проезда:
Установите для поля массива extraComputations значение TOLLS чтобы включить расчет информации о платных дорогах.
Укажите тип транспортного средства и тип платного проезда, используя поле routeModifiersисходных точек маршрута запроса. Возвращаемая стоимость проезда рассчитывается на основе цен, используемых для указанного типа транспортного средства и проезда. Если указано несколько проездов, возвращается наименее дорогой вариант.
Используйте маску поля ответа , чтобы настроить метод возврата информации о платных проездах. Укажите routes.travelAdvisory.tollInfo , чтобы вернуть информацию обо всем маршруте.
[null,null,["Последнее обновление: 2025-08-09 UTC."],[[["\u003cp\u003eThe Routes API's \u003ccode\u003ecomputeRouteMatrix\u003c/code\u003e method allows you to calculate estimated toll fees for routes in supported cities, providing cost insights for route planning.\u003c/p\u003e\n"],["\u003cp\u003eTo enable toll calculations, specify \u003ccode\u003eTOLLS\u003c/code\u003e in the \u003ccode\u003eextraComputations\u003c/code\u003e field and provide vehicle and toll pass details in the \u003ccode\u003erouteModifiers\u003c/code\u003e field within the request.\u003c/p\u003e\n"],["\u003cp\u003eToll prices are estimates and are influenced by factors like vehicle type and toll pass used, with the response including the estimated price in the specified currency.\u003c/p\u003e\n"],["\u003cp\u003eWhile the Route Matrix provides toll information, detailed route specifics are not included; for that, use the \u003ccode\u003eCompute Routes\u003c/code\u003e functionality with single origin and destination points.\u003c/p\u003e\n"],["\u003cp\u003eBe aware that requests including toll fee calculations are billed at a higher rate than standard route matrix requests.\u003c/p\u003e\n"]]],["To calculate toll fees for a route matrix, set the `extraComputations` field to `TOLLS`. Specify the vehicle type and toll pass using the `routeModifiers` field within the origin waypoints; the lowest-cost toll pass pricing will be applied if multiple passes are set. Use the response field mask with `routes.travelAdvisory.tollInfo` to include toll information, and note that toll fee requests have a higher billing rate. The response then contains `estimatedPrice`.\n"],null,["**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\nWhen you are computing a route matrix, you might want to take into consideration\nany toll fees on the routes in the matrix. For select cities, you can compute\nthe estimated toll fee for a route in the appropriate currency.\n\nTo get tolls for a route, see\n[Calculate tolls fees for a route](/maps/documentation/routes/calculate_toll_fees).\n\nFor the list of supported toll locations, see the reference for\n[TollPass](/maps/documentation/routes/reference/rest/v2/RouteModifiers#tollpass).\n| **Caution:** Requests that calculate toll fees are billed at a higher rate. [Learn more about billing](/maps/documentation/routes/usage-and-billing) for the Routes API.\n\nRoute matrix toll example\n\nThe following example uses the\n[`computeRouteMatrix`](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRouteMatrix)\nmethod to return toll information on a route with an estimated\nprice when a toll pass is used:\n\n- Set the `extraComputations` array field to `TOLLS` to enable the calculation\n of toll information.\n\n- Specify the vehicle type and the toll pass type by using the\n `routeModifiers` field of the *origin* waypoints of the request. The toll\n price returned is based on the pricing used by the specified vehicle type\n and pass. If more than one pass is specified, the least expensive pricing is\n returned.\n\n- Use the [response field mask](/maps/documentation/routes/choose_fields) to configure the method to\n return toll information in the response. Specify\n `routes.travelAdvisory.tollInfo` to return information for the entire route.\n\n| **Note:** Route matrix does not return detailed route information, such as the legs, steps, and polylines of the route. To obtain detailed route information, pass a single origin and single destination to [Compute\n| Routes](/maps/documentation/routes/compute_route_directions).\n\nRequest for a route matrix toll information \n\n```console\ncurl -X POST -d '{\n\"origins\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\":42.340173523716736,\n \"longitude\":-71.05997968330408\n }\n }\n },\n \"routeModifiers\": {\n \"vehicleInfo\":{\n \"emissionType\": \"GASOLINE\"\n },\n \"tollPasses\": [\n \"US_MA_EZPASSMA\",\n \"US_WA_GOOD_TO_GO\"\n ]\n }\n }\n],\n\"destinations\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\":42.075698891472804,\n \"longitude\": -72.59806562080408\n }\n }\n }\n }\n],\n\"travelMode\": \"DRIVE\",\n\"extraComputations\": [\"TOLLS\"]\n}' \\\n-H 'Content-Type: application/json' \\\n-H 'X-Goog-Api-Key: \u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e' \\\n-H 'X-Goog-FieldMask: originIndex,destinationIndex,travel_advisory.tollInfo,duration,distanceMeters,status' \\\n'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'\n```\n\nResponse for route matrix toll information\n\nThe response contains information on tolls in a\n[TollInfo](/maps/documentation/routes/reference/rest/v2/TollInfo) (REST) or\n[TollInfo](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#tollinfo) (gRPC) object.\n\nTo configure the method to return toll information, use the\n[response field mask](/maps/documentation/routes/choose_fields) to set the `travelAdvisory.tollInfo` field\nin the mask. \n\n```json\n[\n {\n \"originIndex\": 0,\n \"destinationIndex\": 0,\n \"status\": {},\n \"distanceMeters\": 150338,\n \"duration\": \"5382s\",\n \"travelAdvisory\": {\n \"tollInfo\": {\n \"estimatedPrice\": [\n {\n \"currencyCode\": \"USD\",\n \"units\": \"4\",\n \"nanos\": 400000000\n }\n ]\n }\n }\n }\n]\n```"]]