कैलकुलेट किए गए रास्तों की खास जानकारी
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यूरोपियन इकनॉमिक एरिया (ईईए) के डेवलपर

परिचय
Compute Routes, Routes API सेवा का एक तरीका है. यह एचटीटीपीएस अनुरोध स्वीकार करता है और दो जगहों के बीच का सबसे सही रास्ता दिखाता है.
अलग-अलग जगहों पर साइकल, मोटरसाइकल, कार, बस, मेट्रो वगैरह से या पैदल जाने के लिए, रीयल-टाइम ट्रैफ़िक के साथ रास्ते की जानकारी पाने की सुविधा दें.
क्या आपको रूट मैट्रिक की ज़रूरत है? अगर आपको रास्ते की मैट्रिक में दिलचस्पी है, तो Compute Routes Matrix की खास जानकारी देखें.
क्या माइग्रेट किया जा रहा है? अगर आपको Distance Matrix API (लेगसी) से माइग्रेट करना है, तो Routes API पर माइग्रेट क्यों करना चाहिए से शुरू होने वाले, माइग्रेशन के निर्देश देखें.
Compute Routes का इस्तेमाल क्यों करना चाहिए
'रास्ते का हिसाब लगाएं' सुविधा की मदद से, रास्ते की कई तरह की जानकारी मिलती है. इसकी मदद से, अपनी पसंद के हिसाब से वाहनों या पैकेज को रास्ता दिया जा सकता है. साथ ही, लागत और क्वालिटी को ऑप्टिमाइज़ किया जा सकता है.
Compute Routes की मदद से क्या किया जा सकता है?
Routes API Compute Routes
तरीके की मदद से, ये काम किए जा सकते हैं:
यात्रा के अलग-अलग तरीकों के लिए निर्देश पाएं. साथ ही, एक या एक से ज़्यादा डेस्टिनेशन के लिए निर्देश पाएं:
यात्रा के तरीके: बस, मेट्रो वगैरह, कार, दोपहिया वाहन, पैदल या साइकल.
वे रास्ते जिन पर यात्रा करने के लिए, सबसे सही क्रम में उन्हें ऑप्टिमाइज़ किया जा सकता है.
ऑरिजिन, डेस्टिनेशन, और रास्ते में रुकने के लिए जगहों की जानकारी देने के लिए, कई तरीकों का इस्तेमाल करें:
टेक्स्ट स्ट्रिंग. उदाहरण के लिए: "मुंबई, भारत", "दिल्ली, भारत", "1800
Amphitheatre Parkway, Mountain View, CA 94043" या "CWF6+FWX Mountain
View, California"
जगह के आईडी
अक्षांश और देशांतर के निर्देशांक. इसके साथ, वाहन की दिशा की जानकारी भी दी जा सकती है
अपनी ज़रूरतों और लक्ष्यों के आधार पर, रास्ते के विकल्पों को बेहतर बनाएं:
अपने वाहन के इंजन के हिसाब से, ईंधन या ऊर्जा की कम खपत वाले रास्ते चुनें:
डीज़ल, इलेक्ट्रिक, हाइब्रिड, पेट्रोल. ज़्यादा जानकारी के लिए, ईको-फ़्रेंडली रास्ता पाना लेख पढ़ें.
ट्रैफ़िक का हिसाब लगाने के लिए बेहतर विकल्प सेट करें. इससे, आपको क्वालिटी बनाम इंतज़ार के समय के बीच के फ़ैसले लेने में मदद मिलती है. ज़्यादा जानकारी के लिए, ट्रैफ़िक डेटा को शामिल करने का तरीका और यह तय करना कि उसे शामिल करना है या नहीं लेख पढ़ें.
ईटीए की सटीक जानकारी पाने के लिए, व्यू पॉइंट के लिए वाहन की हेडिंग (यात्रा की दिशा) और सड़क के किनारे की जानकारी सेट करें. ज़्यादा जानकारी के लिए, वाहन की दिशा और सड़क की साइड की जानकारी दें लेख पढ़ें.
बताएं कि सामान को कहां भेजा जाएगा और कहां से वापस लाया जाएगा. साथ ही, बताएं कि सामान को कहां सुरक्षित रखा जाएगा. ज़्यादा जानकारी के लिए, रास्ते में स्टॉप सेट करना और
रास्ते में सेट किया जाने वाला पॉइंट लेख पढ़ें.
रास्ते की दूरी और ईटीए के साथ-साथ, टोल की जानकारी का अनुरोध करें. ज़्यादा जानकारी के लिए, किसी रास्ते के लिए टोल शुल्क का हिसाब लगाना लेख पढ़ें.
फ़ील्ड मास्क का इस्तेमाल करके, सिर्फ़ उस डेटा का अनुरोध करके अपने इंतज़ार का समय और क्वालिटी कंट्रोल करें जिसकी आपको ज़रूरत है. इससे, डेटा प्रोसेस करने में लगने वाले समय और अनुरोध की बिलिंग दरों में बढ़ोतरी से बचा जा सकता है. ज़्यादा जानकारी के लिए, चुनें कि कौनसी जानकारी दिखानी है लेख पढ़ें.
Compute Routes का काम करने का तरीका
Routes API ComputeRoutes
का तरीका, एचटीटीपी पोस्ट अनुरोध को स्वीकार करता है. इसमें अनुरोध के बारे में जानकारी देने वाला JSON अनुरोध बॉडी होता है. ऑरिजिन, डिस्टिनेशन, travelMode
, और फ़ील्ड मास्क की वैल्यू देना ज़रूरी है. इससे यह तय होता है कि कौनसे फ़ील्ड दिखाने हैं.
उदाहरण
curl -X POST -d '{
"origin": {
"address": "1800 Amphitheatre Parkway, Mountain View, CA 94043"
},
"destination": {
"address": "Sloat Blvd &, Upper Great Hwy, San Francisco, CA 94132"
},
"travelMode": "DRIVE"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters' \
'https://routes.googleapis.com/directions/v2:computeRoutes'
इसके बाद, सेवा उस रास्ते का हिसाब लगाती है जिसके लिए अनुरोध किया गया है. साथ ही, वे फ़ील्ड दिखाती है जिनका अनुरोध किया गया है.
संसाधन
नीचे दी गई टेबल में, Routes API के Compute Routes तरीके से मिलने वाले संसाधनों के साथ-साथ, उससे मिलने वाले डेटा के बारे में खास जानकारी दी गई है.
डेटा संसाधन |
डेटा वापस पाना |
रिटर्न का फ़ॉर्मैट |
ComputeRoutes |
अगर अनुरोध किया जाता है, तो किसी रास्ते के लिए रास्ते, लेग, और चरणों के साथ-साथ, वैकल्पिक रास्तों की जानकारी देता है. |
JSON |
Compute Routes का इस्तेमाल करने का तरीका
उपलब्ध क्लाइंट लाइब्रेरी
Compute Routes के लिए उपलब्ध क्लाइंट लाइब्रेरी की सूची देखने के लिए, क्लाइंट लाइब्रेरी देखें.
आगे क्या करना है
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-06-20 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-06-20 (UTC) को अपडेट किया गया."],[],[],null,["# Compute Routes Overview\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\n[](/maps/documentation/routes/demo)\n\nIntroduction\n------------\n\nCompute Routes is a method in the Routes API service that accepts\nan HTTPS request and returns the ideal route between two locations.\nProvide directions with real-time traffic for transit, biking, driving,\n2-wheel motorized vehicles, or walking between multiple locations.\n\n**Need Route Matrixes?** If you are interested in a route matrix, see\n[Compute Route Matrix Overview](/maps/documentation/routes/compute-route-matrix-over).\n\n**Migrating?** If you are migrating from the Distance Matrix API (Legacy),\nsee migration instructions starting with\n[Why migrate to the Routes API](/maps/documentation/routes/migrate-routes-why).\n\nWhy use Compute Routes\n----------------------\n\nWith Compute Routes, with a wide\nrange of route details you can route your vehicles or packages according to\nyour preferences while optimizing for cost and quality.\n\nWhat you can do with Compute Routes?\n------------------------------------\n\nWith the Routes API `Compute Routes` method, you can\ndo the following things:\n\n- **Get directions for different ways to travel**, and for a single or\n multiple destinations:\n\n - Modes of transportation: transit, driving, two-wheel vehicles,\n walking, or bicycling.\n\n - A series of waypoints that you can optimize for the most efficient\n order in which to travel to them.\n\n- **Use multiple ways to specify origins, destinations, and waypoints**:\n\n - Text strings. For example: \"Chicago, IL\", \"Darwin, NT, Australia\", \"1800\n Amphitheatre Parkway, Mountain View, CA 94043\", or \"CWF6+FWX Mountain\n View, California\"\n\n - Place IDs\n\n - Latitude and longitude coordinates, optionally with vehicle heading\n\n- **Fine-tune your route options** based on your needs and goals:\n\n - Select fuel or energy-efficient routes for your vehicle's engine type:\n Diesel, Electric, Hybrid, Gas. For more information, see\n [Get an eco-friendly route](/maps/documentation/routes/eco-routes#request_an_eco-friendly_route).\n\n - Set fine-grained options for traffic calculation, letting you make\n quality versus latency trade off decisions. For details, see\n [Specify how and if to include traffic data](/maps/documentation/routes/config_trade_offs).\n\n - Set vehicle heading (direction of travel) and side-of-road information\n for waypoints to increase ETA accuracy. For details, see\n [Specify vehicle heading and side of road](/maps/documentation/routes/location_modifiers).\n\n - Specify pass-through versus terminal locations and safe stopover\n locations. For details, see [Set a stop along a route](/maps/documentation/routes/stop_over) and\n [Set a point for a route to pass through](/maps/documentation/routes/pass-through).\n\n - Request toll information, along with route distance and ETA. For\n details, see\n [Calculate toll fees for a route](/maps/documentation/routes/calculate_toll_fees).\n\n- **Control your latency and quality** by requesting only the data you need\n using a field mask, which helps you avoid unnecessary processing time and\n higher request billing rates. For details, see\n [Choose what information to return](/maps/documentation/routes/choose_fields).\n\nHow Compute Routes works\n------------------------\n\nThe Routes API `ComputeRoutes` method accepts an HTTP POST request with\na JSON request body that contains the request details. Required are an origin,\ndestination, `travelMode`, and a field mask to specify which fields to return. \n\n#### Example\n\n```json\ncurl -X POST -d '{\n \"origin\": {\n \"address\": \"1800 Amphitheatre Parkway, Mountain View, CA 94043\"\n },\n \"destination\": {\n \"address\": \"Sloat Blvd &, Upper Great Hwy, San Francisco, CA 94132\"\n },\n \"travelMode\": \"DRIVE\"\n }' \\\n -H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \\\n -H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters' \\\n 'https://routes.googleapis.com/directions/v2:computeRoutes'\n```\n\nThe service then calculates the requested route, and returns the fields you've\nrequested.\n\n### Resources\n\nThe following table summarizes the resources available through the\nRoutes API Compute Routes method,\nalong with the data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|----------------------------------------------------------------------|-----------------------------------------------------------------------------------|---------------|\n| [ComputeRoutes](/maps/documentation/routes/compute_route_directions) | Returns routes, legs, and steps for a route, with alternate routes, if requested. | JSON |\n\n\u003cbr /\u003e\n\n### How to use Compute Routes\n\n|---|---------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/routes/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Understand how the Routes API bills** | For information, see [Usage and billing](/maps/documentation/routes/usage-and-billing). |\n| 3 | **Compute a route and review the response** | For more information, see [Get a route](/maps/documentation/routes/compute_route_directions) and [Review the route responses](/maps/documentation/routes/understand-route-response). |\n\n### Available client libraries\n\nFor a list of the available client libraries for\nCompute Routes, see\n[Client libraries](/maps/documentation/routes/client-libraries).\n\nWhat's next\n-----------\n\n- [Get a route](/maps/documentation/routes/compute_route_directions)\n- [Available route options](/maps/documentation/routes/route-opt)\n- [Choose what information to return](/maps/documentation/routes/choose_fields)\n- [Migrate from Directions API (Legacy)](/maps/documentation/routes/migrate-routes)\n- [Migrate from the Routes API preview to GA](/maps/documentation/routes/migrate-routes-preview)"]]