Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Desarrolladores del Espacio Económico Europeo (EEE)
Los puntos de referencia intermedios son ubicaciones entre el origen y el destino por las que deseas que pase la ruta. Un punto de referencia intermedio puede ser una parada o puedes especificarlo como una ubicación de paso. Para ver un ejemplo de un punto de referencia para una parada, consulta Cómo establecer una parada en una ruta. Para ver un ejemplo de un punto de ruta de paso, consulta Cómo establecer un punto para que una ruta lo atraviese.
Usa la propiedad de array intermediates del método computeRoutes (REST) o el método ComputeRoutes (gRPC) para definir hasta un máximo de 25 puntos de ruta intermedios.
Para cada punto de ruta intermedio de la solicitud, el objeto Route (REST) o el objeto Route (gRPC) de la respuesta agrega una entrada al array legs para proporcionar los detalles de ese tramo del viaje.
Ejemplo: Cómo establecer un punto de referencia intermedio
En el siguiente ejemplo, se usa la propiedad de array intermediates para agregar una sola parada intermedia al cuerpo de la solicitud POST de una ruta.
En este ejemplo, se usa una máscara de campo de respuesta en el encabezado X-Goog-FieldMask que especifica que se deben devolver los siguientes campos en la respuesta:
routes.duration
routes.distanceMeters
routes.legs correspondiente a todo el objeto RouteLeg.
[null,null,["Última actualización: 2025-07-22 (UTC)"],[[["\u003cp\u003eIntermediate waypoints allow you to specify locations between the origin and destination for a route to pass through or stop at.\u003c/p\u003e\n"],["\u003cp\u003eYou can define up to 25 intermediate waypoints using the \u003ccode\u003eintermediates\u003c/code\u003e property when computing routes, but requests with 11 or more are billed at a higher rate.\u003c/p\u003e\n"],["\u003cp\u003eThe response provides route details including legs, with each leg representing a segment of the journey between waypoints.\u003c/p\u003e\n"],["\u003cp\u003eEach leg within the route is further broken down into steps, providing detailed information about each segment of the journey.\u003c/p\u003e\n"]]],["Intermediate waypoints, placed between the origin and destination, guide the route. Use the `intermediates` array in the `computeRoutes` method to define up to 25 waypoints, with options for stops or pass-throughs. Each waypoint adds a `leg` to the route's details. Requests with 11-25 waypoints are billed at a higher rate. Each route `leg` can be specified with desired fields through a response field mask to return the `duration`, `distanceMeters`, and `legs`.\n"],null,["# Set intermediate waypoints\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\nIntermediate waypoints are locations in between the origin and destination\nthat you want the route to go through. An intermediate waypoint can be a stop or\nyou can specify it as a location to pass through. For an example of a waypoint\nfor a stop, see [Set a stop along a route](/maps/documentation/routes/stop_over). For an example of a\nwaypoint to pass-through,\n[Set point for a route to pass-through](/maps/documentation/routes/pass-through).\n| **Note:** Intermediate waypoints are not supported in the Compute Route Matrix.\n\nUse the `intermediates` array property of the\n[computeRoutes](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes) method (REST) or the\n[ComputeRoutes](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#google.maps.routing.v2.Routes.ComputeRoutes)\nmethod (gRPC), to define up to a maximum of 25 intermediate waypoints.\n| **Caution:** If you make requests using 11 or more intermediate waypoints (between 11 and 25), your requests are billed at a higher rate. [Learn more about billing](/maps/documentation/routes/usage-and-billing) for Routes API.\n\nFor each intermediate waypoint in the request, the\n[Route object](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#route) (REST) or\n[Route object](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#route) (gRPC) in the\nresponse adds an entry to the `legs` array to provide the details for\nthat leg of the journey.\n\nEach leg of a route is represented by a\n[RouteLeg](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#routeleg) (REST) or\n[RouteLeg](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#routeleg) (gRPC) object.\nControl which `RouteLeg` fields to return by using the\n[response field mask](/maps/documentation/routes/choose_fields).\n\nExample - Set an intermediate waypoint\n--------------------------------------\n\nThe following example uses the `intermediates` array property to add a single\nintermediate waypoint to the POST request body of a route.\n\nThis example uses a response field mask in the `X-Goog-FieldMask` header\nthat specifies to return the following fields in the response:\n\n- `routes.duration`\n- `routes.distanceMeters`\n- `routes.legs` corresponding to the entire `RouteLeg` object.\n\n```json\ncurl -X POST -d '{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.419734,\n \"longitude\": -122.0827784\n }\n },\n \"sideOfRoad\": true\n },\n \"destination\":{\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.417670,\n \"longitude\": -122.079595\n }\n }\n },\n \"intermediates\": [\n {\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.419734,\n \"longitude\": -122.0807784\n }\n }\n }\n ],\n \"travelMode\": \"DRIVE\",\n \"routingPreference\": \"TRAFFIC_AWARE\",\n \"departureTime\": \"2022-10-15T15:01:23.045123456Z\",\n \"computeAlternativeRoutes\": false,\n \"routeModifiers\": {\n \"avoidTolls\": false,\n \"avoidHighways\": false,\n \"avoidFerries\": false\n },\n \"languageCode\": \"en-US\",\n \"units\": \"IMPERIAL\"\n}'\n-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY'\n-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.legs'\n'https://routes.googleapis.com/directions/v2:computeRoutes'\n```\n\nThe response from this call contains the `legs` array. Each step of the leg is\nrepresented by a\n[RouteLegStep](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#routelegstep) (REST) or\n[RouteLegStep](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#routelegstep) (gRPC) object. \n\n```json\n{\n \"routes\": [\n {\n \"legs\": [\n # First leg\n {\n \"distanceMeters\": 207,\n \"duration\": \"89s\",\n \"staticDuration\": \"89s\",\n \"polyline\": {\n \"encodedPolyline\": \"ipkcFjgchVd@@@cF]@@oCK?\"\n },\n \"startLocation\": {\n \"latLng\": {\n \"latitude\": 37.4197318,\n \"longitude\": -122.0826233\n }\n },\n \"endLocation\": {\n \"latLng\": {\n \"latitude\": 37.419734,\n \"longitude\": -122.08077919999998\n }\n },\n \"steps\": [ {\n \"distanceMeters\": 21,\n \"staticDuration\": \"6s\",\n \"polyline\": {\n \"encodedPolyline\": \"ipkcFjgchVd@@\"\n },\n \"startLocation\": {\n \"latLng\": {\n \"latitude\": 37.4197318,\n \"longitude\": -122.0826233\n }\n },\n \"endLocation\": {\n \"latLng\": {\n \"latitude\": 37.41954,\n \"longitude\": -122.08262750000002\n }\n }\n },\n ...\n },\n # Second leg\n {\n \"distanceMeters\": 598,\n \"duration\": \"159s\",\n \"staticDuration\": \"159s\",\n \"polyline\": {\n \"encodedPolyline\": \"ipkcFz{bhVh@??{@xPBP?J}E{E?\"\n },\n \"startLocation\": {\n \"latLng\": {\n \"latitude\": 37.419734,\n \"longitude\": -122.08077919999998\n }\n },\n \"endLocation\": {\n \"latLng\": {\n \"latitude\": 37.417616599999995,\n \"longitude\": -122.07938820000001\n }\n },\n \"steps\": [\n {\n ...\n```"]]