সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ইউরোপিয়ান ইকোনমিক এরিয়া (EEA) ডেভেলপার
ডিফল্টরূপে, Routes API Compute Routes পদ্ধতি একাধিক স্টপের মাধ্যমে একটি রুট গণনা করে, যাকে স্টপওভার ওয়েপয়েন্ট বলা হয়, আপনি যে ক্রমে সেগুলি প্রদান করেন।
আপনি আরও দক্ষ ক্রমে স্টপগুলিকে পুনর্বিন্যাস করে প্রদত্ত রুটটিকে অপ্টিমাইজ করার জন্য Routes API-কে করতে পারেন৷ ওয়েপয়েন্ট অপ্টিমাইজেশান ভ্রমণের সময়ের জন্য অপ্টিমাইজ করে তবে কোন রুটটি সবচেয়ে কার্যকর তা নির্ধারণ করার সময় দূরত্ব এবং বাঁকের সংখ্যার মতো অন্যান্য কারণগুলিও বিবেচনা করে।
ওয়েপয়েন্ট অপ্টিমাইজ করতে
নিশ্চিত করুন যে রুটের কোনো ওয়েপয়েন্টের viatrue সেট করা নেই, উদাহরণস্বরূপ: {"address": "Clare,SA", "via": true} । মধ্যবর্তী ওয়েপয়েন্ট সম্পর্কে আরও তথ্যের জন্য, মধ্যবর্তী পথপয়েন্ট নির্দিষ্ট করুন দেখুন।
নিশ্চিত করুন যে routing_preferenceTRAFFIC_AWARE_OPTIMAL এ সেট করা নেই।
optimize_waypoint_ordertrue সেট করুন। যেমন:
"optimizeWaypointOrder":"true",
ফিল্ড মাস্কে routes.optimizedIntermediateWaypointIndex ক্ষেত্রটি নির্দিষ্ট করুন:
কিভাবে ওয়েপয়েন্ট অর্ডার অপ্টিমাইজ করা হয় তা বুঝুন
এখানে কিভাবে Routes API একটি রুটে ওয়েপয়েন্টের ক্রম অপ্টিমাইজ করে:
0 দিয়ে শুরু করে আপনি অনুরোধে যে ক্রমটি প্রদান করেন তার উপর ভিত্তি করে স্বয়ংক্রিয়ভাবে ওয়েপয়েন্টগুলিকে সূচিবদ্ধ করে৷
অনুরোধে ওয়েপয়েন্টগুলিতে নির্ধারিত সূচক নম্বরগুলি ব্যবহার করে ওয়েপয়েন্টের ক্রমটি অপ্টিমাইজ করে।
routes অবজেক্টে, waypoint_order ক্ষেত্রে, routes.optimizedIntermediateWaypointIndex এর অধীনে অপ্টিমাইজ করা ওয়েপয়েন্ট অর্ডার প্রদান করে।
উদাহরণ
এই অনুরোধটি অ্যাডিলেড, দক্ষিণ অস্ট্রেলিয়া থেকে দক্ষিণ অস্ট্রেলিয়ার প্রতিটি প্রধান ওয়াইন অঞ্চলে যাওয়ার এবং তারপর অ্যাডিলেডে ফিরে যাওয়ার জন্য একটি রুট অপ্টিমাইজ করার জন্য জিজ্ঞাসা করে।
[null,null,["2025-07-22 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThe Routes API's \u003ccode\u003eCompute Routes\u003c/code\u003e method can optimize the order of stops (waypoints) for greater efficiency by considering factors like travel time, distance, and turns.\u003c/p\u003e\n"],["\u003cp\u003eTo enable waypoint optimization, ensure no waypoints are marked as \u003ccode\u003evia\u003c/code\u003e, avoid using \u003ccode\u003eTRAFFIC_AWARE_OPTIMAL\u003c/code\u003e routing preference, and set \u003ccode\u003eoptimizeWaypointOrder\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe API indexes waypoints based on their order in the request, optimizes the order, and returns the optimized sequence in the \u003ccode\u003eoptimizedIntermediateWaypointIndex\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eRequests with waypoint optimization are billed at a higher rate on the ComputeRoutes-Advanced SKU.\u003c/p\u003e\n"]]],["The Routes API can optimize the order of stopover waypoints to create a more efficient route. To enable this, set `optimize_waypoint_order` to `true`, ensure no waypoints have `via: true` and the `routing_preference` is not `TRAFFIC_AWARE_OPTIMAL`. The API indexes waypoints, optimizes their order based on factors like travel time and distance, and returns the optimized order in `routes.optimizedIntermediateWaypointIndex`. This optimization is billed at a higher rate.\n"],null,["# Optimize the order of stops on your route\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\nBy default, the Routes API `Compute Routes`\nmethod calculates a route through multiple stops, called stopover waypoints, in\nthe order that you provide them.\n\nYou can have the Routes API optimize the provided route by rearranging\nstops in a more efficient order. Waypoint optimization optimizes for travel\ntime but also considers other factors such as distance and number of turns when\ndeciding which route is the most efficient.\n\nTo optimize waypoints\n---------------------\n\n1. Make sure none of the waypoints in the route have `via` set to `true`, for\n example: `{\"address\": \"Clare,SA\", \"via\": true}`. For more information about\n intermediate waypoints, see\n [Specify intermediate waypoints](/maps/documentation/routes/intermed_waypoints).\n\n2. Make sure the `routing_preference` is not set to `TRAFFIC_AWARE_OPTIMAL`.\n\n3. Set `optimize_waypoint_order` to `true`. For example:\n\n ```json\n \"optimizeWaypointOrder\": \"true\",\n ```\n4. Specify the `routes.optimizedIntermediateWaypointIndex` field in the field\n mask:\n\n **REST** \n\n ```json\n -H X-Goog-FieldMask: routes.optimizedIntermediateWaypointIndex\n ```\n\n **RPC** \n\n ```gdscript\n const (fieldMask = \"routes.optimizedIntermediateWaypointIndex\")\n ```\n\n### Understand how waypoint order is optimized\n\nHere's how the Routes API optimizes the order of waypoints in a route:\n\n1. Automatically indexes the waypoints based on the order you provide\n them in the request, starting with 0.\n\n2. Optimizes the order of the waypoints using the index numbers it\n assigned to the waypoints in the request.\n\n3. Returns the optimized waypoint order in the `routes` object, in the\n `waypoint_order` field, under `routes.optimizedIntermediateWaypointIndex`.\n\n### Example\n\nThis request asks for optimization for a route from Adelaide, South Australia,\nto each of South Australia's main wine regions, and then returning to Adelaide. \n\n```json\ncurl -X POST -H 'content-type: application/json' -d ' {\n \"origin\": {\n \"address\": \"Adelaide,SA\"\n },\n \"destination\": {\n \"address\": \"Adelaide,SA\"\n },\n \"intermediates\": [\n {\"address\": \"Barossa+Valley,SA\"},\n {\"address\": \"Clare,SA\"},\n {\"address\": \"Coonawarra,SA\"},\n {\"address\": \"McLaren+Vale,SA\"}\n ],\n \"travelMode\": \"DRIVE\",\n \"optimizeWaypointOrder\": \"true\"\n }' \\\n-H 'Content-Type: application/json' \\\n-H 'X-Goog-Api-Key: YOUR_API_KEY' \\\n-H 'X-Goog-FieldMask: routes,geocodingResults.intermediates.intermediateWaypointRequestIndex' \\\n'https://routes.googleapis.com/directions/v2:computeRoutes'\n```\n\nThe Routes API indexes the intermediate waypoints provided in the\nrequest, starting at 0. For example: \n\n```json\n0 {\"address\": \"Barossa+Valley,SA\"},\n1 {\"address\": \"Clare,SA\"},\n2 {\"address\": \"Coonawarrav,SA\"},\n3 {\"address\": \"McLaren+Vale,SA\"}\n```\n\nUsing the index numbers for the four waypoints provided in the request, the\nservice then returns the optimized order: \n\n```json\n\"optimizedIntermediateWaypointIndex\": [\n 3,\n 2,\n 0,\n 1\n ]\n```\n| **Caution:** Requests using waypoint optimization are billed at a higher rate on the SKU for Compute Routes Pro. For more details, see [SKU: Routes: Compute Routes Pro](/maps/documentation/routes/usage-and-billing#compute-routes-pro-sku)."]]