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

Directions API (लेगसी), एक ऐसी सेवा है जो एचटीटीपी अनुरोध स्वीकार करती है. साथ ही, जगहों के बीच के रास्ते की जानकारी को JSON या XML फ़ॉर्मैट में दिखाती है.
Directions API का इस्तेमाल क्यों करें
Directions API की मदद से, यात्रा के कई तरीकों के लिए दिशा-निर्देश पाए जा सकते हैं. जैसे, बस, मेट्रो वगैरह से यात्रा करना, ड्राइविंग करना, पैदल चलना या साइकल चलाना.
Directions API का इस्तेमाल करके क्या-क्या किया जा सकता है?
Directions API की मदद से, जगहों के बीच के दिशा-निर्देशों का हिसाब लगाया जा सकता है. इसमें यह जानकारी भी शामिल होती है:
- बस, मेट्रो वगैरह से, कार से, पैदल चलकर या साइकल चलाकर जाने के लिए दिशा-निर्देश.
- रास्ते में पड़ने वाली जगहों की जानकारी का इस्तेमाल करके, कई हिस्सों में बंटे निर्देशों को पाना.
- शुरुआत की जगह, मंज़िल, और रास्ते में पड़ने वाली जगहों की जानकारी कई तरीकों से दी जा सकती है. जैसे, टेक्स्ट स्ट्रिंग ("शिकागो, इलिनॉय" या "डार्विन, नॉर्दर्न टेरिटरी, ऑस्ट्रेलिया"), जगह के आईडी या अक्षांश/देशांतर निर्देशांक.
Directions API कैसे काम करता है
रास्ता तय करते समय, Directions API सबसे कम खपत वाले रास्ते दिखाता है. सबसे अच्छा रास्ता तय करते समय, यह प्रॉडक्ट यात्रा से जुड़ी इन बातों का ध्यान रखता है:
- यात्रा में लगने वाला समय (मुख्य)
- दूरी
- टर्न की संख्या
यहां दिए गए उदाहरण अनुरोध में, टोरंटो, ओंटारियो से मॉन्ट्रियल, क्यूबेक तक के ड्राइविंग निर्देश JSON फ़ॉर्मैट में दिखाए गए हैं:
https://maps.googleapis.com/maps/api/directions/json
?destination=Montreal
&origin=Toronto
&key=YOUR_API_KEY
संसाधन
नीचे दी गई टेबल में, Directions API के ज़रिए उपलब्ध संसाधनों की खास जानकारी दी गई है. साथ ही, यह भी बताया गया है कि इन संसाधनों से कौनसा डेटा मिलता है.
डेटा संसाधन |
डेटा वापस लाया गया |
जवाब का फ़ॉर्मैट |
रास्ता
जगह के आईडी, पतों या अक्षांश/देशांतर निर्देशांकों के तौर पर, सप्लाई के मूल और गंतव्य की जानकारी दें. ज़्यादा जानकारी के लिए, ज़रूरी पैरामीटर देखें.
|
मोड़-दर-मोड़ दिशा-निर्देशों को रास्तों, लेग, और चरणों में बांटा गया है. ज़्यादा जानकारी के लिए, रास्ते की जानकारी देने वाले जवाब देखें.
|
|
Directions API का इस्तेमाल कैसे करें
1 |
सेट अप करें. |
सबसे पहले, Google Cloud प्रोजेक्ट सेट अप करें. इसके बाद, सेट अप करने के लिए दिए गए निर्देशों का पालन करें. |
2 |
डेमो आज़माएँ |
एपीआई कुंजी और क्लाउड प्रोजेक्ट मिलने के बाद, बिना किसी शुल्क के निर्देशों का डेमो आज़माएं. Directions API का डेमो देखें.
|
3 |
अनुरोध बनाना |
अनुरोधों के उदाहरण देखें. साथ ही, उपलब्ध उन विकल्पों के बारे में जानें जिन्हें दिया जा सकता है. जैसे, यात्रा के तरीके, वेपॉइंट, और रास्ते से जुड़ी पाबंदियां. दिशा-निर्देशों के उदाहरण देखें.
|
4 |
जवाब देने से जुड़ी बुनियादी बातें समझना |
अपने ऐप्लिकेशन के लिए दिशा-निर्देशों से जुड़ा डेटा इस्तेमाल करने की तैयारी करने के लिए, डेटा रिस्पॉन्स एक्सप्लोर करें. ज़्यादा जानकारी के लिए, दिशा-निर्देशों से जुड़े रिस्पॉन्स देखें.
|
5 |
अपने ऐप्लिकेशन में दिशा-निर्देशों का डेटा शामिल करें! |
इस डेटा का इस्तेमाल, यात्रा की दूरी और समय का हिसाब लगाने के लिए किया जा सकता है.
|
उपलब्ध क्लाइंट लाइब्रेरी
इस एपीआई को अपनी पसंद की भाषा में कॉल करें. इसके लिए, इनमें से किसी एक क्लाइंट लाइब्रेरी का इस्तेमाल करें:
Google Maps Services के लिए Java Client, Python Client, Go Client, और Node.js Client, कम्यूनिटी की ओर से सपोर्ट की जाने वाली क्लाइंट लाइब्रेरी हैं. इन्हें Apache 2.0 License के तहत ओपन सोर्स किया गया है.
इन्हें GitHub से डाउनलोड करें. यहां आपको इंस्टॉल करने के निर्देश और सैंपल कोड भी मिल सकता है.
आगे क्या करना है
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-09-03 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-09-03 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThe Directions API provides route information between locations using various transportation modes like driving, walking, transit, or bicycling.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize your requests by specifying origins, destinations, waypoints, and travel preferences.\u003c/p\u003e\n"],["\u003cp\u003eThe API calculates the most efficient routes based on travel time, distance, and the number of turns.\u003c/p\u003e\n"],["\u003cp\u003eResults are available in JSON or XML format and include detailed directions, routes, legs, and steps.\u003c/p\u003e\n"],["\u003cp\u003eClient libraries are available in Java, Python, Go, and Node.js for easy integration into your applications.\u003c/p\u003e\n"]]],[],null,["# Directions API (Legacy) 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\nThe Directions API (Legacy) is a service that accepts an HTTP request and returns JSON or XML-formatted directions between locations.\n\nWhy use the Directions API\n--------------------------\n\nWith the Directions API, you can get directions for several modes of\ntransportation, such as transit, driving, walking, or bicycling.\n\nWhat you can do with the Directions API?\n----------------------------------------\n\nWith the Directions API, you can calculate directions between locations,\nincluding the following details:\n\n- Directions for several modes of transportation, including transit, driving, walking or bicycling.\n- Multipart directions using a series of waypoints.\n- Specify origins, destinations, and waypoints in multiple ways, including as text strings (for example, \"Chicago, IL\" or \"Darwin, NT, Australia\"), place IDs, or latitude/longitude coordinates.\n\nHow the Directions API works\n----------------------------\n\nThe Directions API returns the most efficient routes when\ncalculating directions. The product factors in the following travel elements\nwhen determining the most efficient route:\n\n- Travel time (primary)\n- Distance\n- Number of turns\n\nThe following example request returns driving directions from Toronto, Ontario to Montreal, Quebec in JSON format: \n\n```scdoc\nhttps://maps.googleapis.com/maps/api/directions/json\n ?destination=Montreal\n &origin=Toronto\n &key=YOUR_API_KEY\n```\n\n### Resources\n\nThe following table summarizes the resources available through the\nDirections API along with the data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| [Directions](/maps/documentation/directions/get-directions#DirectionsRequests) Supply origins and destinations in the form of place IDs, addresses, or latitude/longitude coordinates. See [required parameters](/maps/documentation/directions/get-directions#required-parameters) for details. | Detailed directions, broken into routes, legs, and steps. See [Directions responses](/maps/documentation/directions/get-directions#DirectionsResponses) for details. | - JSON - XML |\n\n\u003cbr /\u003e\n\nHow to use the Directions API\n-----------------------------\n\n|---|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up.** | Start with [Set up your Google Cloud project](/maps/documentation/directions/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try the demo** | Once you have an API key and a cloud project you try out the directions demo at no charge. See [The Directions API demo](/maps/documentation/directions/start). |\n| 3 | **Build a request** | See the example requests and learn about the available options you can supply, such as travel modes, waypoints, and route restrictions. See [Directions examples](/maps/documentation/directions/get-directions#ExampleRequests). |\n| 4 | **Understand response basics** | Explore the data responses to prepare to use directions data for your app. See [Directions responses](/maps/documentation/directions/get-directions#DirectionsResponses) for details. |\n| 5 | **Incorporate direction data into your own app!** | You can use this data to calculate travel distance and time. |\n\n#### Available client libraries\n\nCall this API in the language of\nyour choice through one of the following client libraries:\n\n- [Java\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client\n for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nThe Java Client, Python Client, Go Client and Node.js Client for Google Maps\nServices are community-supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\nDownload them from GitHub, where you can also find installation instructions and sample code.\n\nWhat's next\n-----------\n\n- **Start using the Directions API** : Go to [Get started](/maps/documentation/directions/start).\n- **Start making Directions requests** : Go to [Get\n directions](/maps/documentation/directions/get-directions).\n- **Follow best practices** : Go to [Web service best\n practices](/maps/documentation/directions/web-service-best-practices)."]]