Method: computeRouteMatrix
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
উত্স এবং গন্তব্যগুলির একটি তালিকা নেয় এবং উত্স এবং গন্তব্যের প্রতিটি সংমিশ্রণের জন্য রুট তথ্য সম্বলিত একটি স্ট্রিম প্রদান করে৷
দ্রষ্টব্য: এই পদ্ধতির জন্য আপনাকে ইনপুটে একটি প্রতিক্রিয়া ক্ষেত্র মাস্ক নির্দিষ্ট করতে হবে। আপনি URL প্যারামিটার $fields
বা fields
ব্যবহার করে প্রতিক্রিয়া ক্ষেত্র মাস্ক প্রদান করতে পারেন, অথবা HTTP/gRPC হেডার X-Goog-FieldMask
ব্যবহার করে ( উপলব্ধ URL প্যারামিটার এবং শিরোনাম দেখুন। মান হল ফিল্ড পাথগুলির একটি কমা বিভক্ত তালিকা। ক্ষেত্র পাথ কিভাবে নির্মাণ করতে হয় সে সম্পর্কে এই বিস্তারিত ডকুমেন্টেশন দেখুন।
উদাহরণস্বরূপ, এই পদ্ধতিতে:
- সমস্ত উপলব্ধ ক্ষেত্রের ফিল্ড মাস্ক (ম্যানুয়াল পরিদর্শনের জন্য):
X-Goog-FieldMask: *
- রুটের সময়কাল, দূরত্ব, উপাদানের স্থিতি, অবস্থা, এবং উপাদান সূচকের ফিল্ড মাস্ক (উদাহরণস্বরূপ উত্পাদন সেটআপ):
X-Goog-FieldMask: originIndex,destinationIndex,status,condition,distanceMeters,duration
এটা গুরুত্বপূর্ণ যে আপনি আপনার ফিল্ড মাস্কে status
অন্তর্ভুক্ত করুন কারণ অন্যথায় সমস্ত বার্তা ঠিক আছে বলে মনে হবে। Google ওয়াইল্ডকার্ড ( *
) প্রতিক্রিয়া ফিল্ড মাস্ক ব্যবহারকে নিরুৎসাহিত করে, কারণ:
- শুধুমাত্র আপনার প্রয়োজনীয় ক্ষেত্রগুলি নির্বাচন করা আমাদের সার্ভারকে গণনা চক্র সংরক্ষণ করতে সাহায্য করে, যা আমাদেরকে কম বিলম্বে আপনার কাছে ফলাফল ফেরত দেওয়ার অনুমতি দেয়।
- আপনার প্রোডাকশন কাজের জন্য আপনার প্রয়োজনীয় ক্ষেত্রগুলি নির্বাচন করা স্থিতিশীল লেটেন্সি কর্মক্ষমতা নিশ্চিত করে। আমরা ভবিষ্যতে আরও প্রতিক্রিয়া ক্ষেত্র যোগ করতে পারি, এবং সেই নতুন ক্ষেত্রগুলির জন্য অতিরিক্ত গণনা সময় প্রয়োজন হতে পারে। আপনি যদি সমস্ত ক্ষেত্র নির্বাচন করেন, বা আপনি যদি শীর্ষ স্তরে সমস্ত ক্ষেত্র নির্বাচন করেন, তাহলে আপনি কর্মক্ষমতা হ্রাস পেতে পারেন কারণ আমরা যে কোনও নতুন ক্ষেত্র যোগ করি তা স্বয়ংক্রিয়ভাবে প্রতিক্রিয়াতে অন্তর্ভুক্ত হবে।
- শুধুমাত্র যে ক্ষেত্রগুলি আপনার প্রয়োজন সেগুলি নির্বাচন করলে ফলাফল একটি ছোট প্রতিক্রিয়ার আকার, এবং এইভাবে উচ্চতর নেটওয়ার্ক থ্রুপুট।
HTTP অনুরোধ
POST https://routespreferred.googleapis.com/v1alpha:computeRouteMatrix
URL gRPC ট্রান্সকোডিং সিনট্যাক্স ব্যবহার করে।
শরীরের অনুরোধ
অনুরোধের অংশে নিম্নলিখিত কাঠামো সহ ডেটা রয়েছে:
ক্ষেত্র |
---|
origins[] | object ( RouteMatrixOrigin ) প্রয়োজন। উৎপত্তির বিন্যাস, যা প্রতিক্রিয়া ম্যাট্রিক্সের সারি নির্ধারণ করে। উত্স এবং গন্তব্যের মূলত্বের জন্য বেশ কয়েকটি আকারের সীমাবদ্ধতা প্রযোজ্য: - উপাদানের সংখ্যা (উৎপত্তি × গন্তব্য) কোন ক্ষেত্রেই 625 এর বেশি হওয়া উচিত নয়।
- রাউটিং পছন্দ
TRAFFIC_AWARE_OPTIMAL এ সেট করা থাকলে উপাদানের সংখ্যা (উৎপত্তি × গন্তব্য) 100 এর বেশি হওয়া উচিত নয়। -
placeId হিসাবে নির্দিষ্ট করা ওয়েপয়েন্টের সংখ্যা (উৎপত্তি + গন্তব্য) 50 এর বেশি হওয়া উচিত নয়।
|
destinations[] | object ( RouteMatrixDestination ) প্রয়োজন। গন্তব্যের অ্যারে, যা প্রতিক্রিয়া ম্যাট্রিক্সের কলাম নির্ধারণ করে। |
travel Mode | enum ( RouteTravelMode ) ঐচ্ছিক। পরিবহনের মোড নির্দিষ্ট করে। |
routing Preference | enum ( RoutingPreference ) ঐচ্ছিক। রুট গণনা কিভাবে নির্দিষ্ট করে. সার্ভার রুট গণনা করার জন্য নির্বাচিত রাউটিং পছন্দ ব্যবহার করার চেষ্টা করে। যদি রাউটিং পছন্দ একটি ত্রুটি বা একটি অতিরিক্ত দীর্ঘ লেটেন্সি ফলাফল, একটি ত্রুটি ফিরে আসে. আপনি এই বিকল্পটি শুধুমাত্র তখনই নির্দিষ্ট করতে পারেন যখন travelMode DRIVE বা TWO_WHEELER হয়, অন্যথায় অনুরোধটি ব্যর্থ হয়। |
departure Time | string ( Timestamp format) ঐচ্ছিক। প্রস্থানের সময়। আপনি যদি এই মানটি সেট না করেন তবে এটি আপনার অনুরোধ করার সময় ডিফল্ট হবে। যদি আপনি এই মানটি এমন একটি সময়ে সেট করেন যা ইতিমধ্যে ঘটেছে, অনুরোধটি ব্যর্থ হয়। RFC3339 UTC "জুলু" ফর্ম্যাটে একটি টাইমস্ট্যাম্প, ন্যানোসেকেন্ড রেজোলিউশন এবং নয়টি পর্যন্ত ভগ্নাংশের সংখ্যা। উদাহরণ: "2014-10-02T15:01:23Z" এবং "2014-10-02T15:01:23.045123456Z" । |
প্রতিক্রিয়া শরীর
সফল হলে, প্রতিক্রিয়া বডিতে RouteMatrixElement
দৃষ্টান্তের একটি স্ট্রীম থাকে।
অনুমোদনের সুযোগ
নিম্নলিখিত OAuth সুযোগ প্রয়োজন:
-
https://www.googleapis.com/auth/maps-platform.routespreferred
আরও তথ্যের জন্য, OAuth 2.0 ওভারভিউ দেখুন।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eTakes a list of origins and destinations, returning route information for each combination.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying a response field mask for optimized performance and data selection.\u003c/p\u003e\n"],["\u003cp\u003eAccepts parameters for travel mode, routing preference, and departure time.\u003c/p\u003e\n"],["\u003cp\u003eReturns a stream of \u003ccode\u003eRouteMatrixElement\u003c/code\u003e instances containing route details.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003ehttps://www.googleapis.com/auth/maps-platform.routespreferred\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],["This method computes route information for multiple origin-destination pairs. It requires a `POST` request to `computeRouteMatrix` with lists of `origins` and `destinations` in the request body. A field mask must be included to specify which data fields to return, with `status` being critical. Optional parameters include `travelMode`, `routingPreference`, and `departureTime`. The response is a stream of `RouteMatrixElement` instances, and the method requires a specific OAuth scope for authorization.\n"],null,["# Method: computeRouteMatrix\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nTakes in a list of origins and destinations and returns a stream containing route information for each combination of origin and destination.\n\n**NOTE:** This method requires that you specify a response field mask in the input. You can provide the response field mask by using the URL parameter `$fields` or `fields`, or by using the HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated list of field paths. See this detailed documentation about [how to construct the field paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto).\n\nFor example, in this method:\n\n- Field mask of all available fields (for manual inspection): `X-Goog-FieldMask: *`\n- Field mask of route durations, distances, element status, condition, and element indices (an example production setup): `X-Goog-FieldMask:\n originIndex,destinationIndex,status,condition,distanceMeters,duration`\n\nIt is critical that you include `status` in your field mask as otherwise all messages will appear to be OK. Google discourages the use of the wildcard (`*`) response field mask, because:\n\n- Selecting only the fields that you need helps our server save computation cycles, allowing us to return the result to you with a lower latency.\n- Selecting only the fields that you need in your production job ensures stable latency performance. We might add more response fields in the future, and those new fields might require extra computation time. If you select all fields, or if you select all fields at the top level, then you might experience performance degradation because any new field we add will be automatically included in the response.\n- Selecting only the fields that you need results in a smaller response size, and thus higher network throughput.\n\n### HTTP request\n\n`POST https://routespreferred.googleapis.com/v1alpha:computeRouteMatrix`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"origins\": [ { object (/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin) } ], \"destinations\": [ { object (/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination) } ], \"travelMode\": enum (/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode), \"routingPreference\": enum (/maps/documentation/routes_preferred/reference/rest/Shared.Types/RoutingPreference), \"departureTime\": string } ``` |\n\n| Fields ||\n|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `origins[]` | `object (`[RouteMatrixOrigin](/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin)`)` Required. Array of origins, which determines the rows of the response matrix. Several size restrictions apply to the cardinality of origins and destinations: - The number of elements (origins × destinations) must be no greater than 625 in any case. - The number of elements (origins × destinations) must be no greater than 100 if routingPreference is set to `TRAFFIC_AWARE_OPTIMAL`. - The number of waypoints (origins + destinations) specified as `placeId` must be no greater than 50. |\n| `destinations[]` | `object (`[RouteMatrixDestination](/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination)`)` Required. Array of destinations, which determines the columns of the response matrix. |\n| `travel``Mode` | `enum (`[RouteTravelMode](/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode)`)` Optional. Specifies the mode of transportation. |\n| `routing``Preference` | `enum (`[RoutingPreference](/maps/documentation/routes_preferred/reference/rest/Shared.Types/RoutingPreference)`)` Optional. Specifies how to compute the route. The server attempts to use the selected routing preference to compute the route. If the routing preference results in an error or an extra long latency, an error is returned. You can specify this option only when the `travelMode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. |\n| `departure``Time` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Optional. The departure time. If you don't set this value, this defaults to the time that you made the request. If you set this value to a time that has already occurred, the request fails. A timestamp in RFC3339 UTC \"Zulu\" format, with nanosecond resolution and up to nine fractional digits. Examples: `\"2014-10-02T15:01:23Z\"` and `\"2014-10-02T15:01:23.045123456Z\"`. |\n\n### Response body\n\nIf successful, the response body contains a stream of [RouteMatrixElement](/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteMatrixElement) instances.\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/maps-platform.routespreferred`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]