यह प्रॉडक्ट या सुविधा, लेगसी स्टेटस में है. लेगसी स्टेज और लेगसी से नई सेवाओं पर माइग्रेट करने के तरीके के बारे में ज़्यादा जानने के लिए, लेगसी प्रॉडक्ट और सुविधाएं लेख पढ़ें.
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यूरोपियन इकनॉमिक एरिया (ईईए) के डेवलपर
परिचय
Distance Matrix API (लेगसी), एक ऐसी सेवा है जो एचटीटीपीएस अनुरोध स्वीकार करती है. इस अनुरोध में, परिवहन के किसी तरीके के लिए शुरुआती और मंज़िल की जानकारी होती है. यह शुरुआत की जगह और मंज़िल के हर कॉम्बिनेशन के लिए, यात्रा की दूरी और अवधि दिखाता है.
Distance Matrix API का इस्तेमाल क्यों करें
Distance Matrix API का इस्तेमाल करके, एक से ज़्यादा जगहों से यात्रा शुरू करने और पहुंचने के लिए, सबसे सही रास्ते तय किए जा सकते हैं. उदाहरण के लिए, किन कर्मचारियों को नौकरी की साइटों पर भेजना है या किन गोदामों से पैकेज भेजने हैं.
Distance Matrix API का इस्तेमाल करके क्या-क्या किया जा सकता है
Distance Matrix API की मदद से, ओरिजन और डेस्टिनेशन के मैट्रिक्स के लिए यात्रा की दूरी और समय की जानकारी दी जा सकती है. आपके पास कई विकल्प चुनने का विकल्प होता है. जैसे, यात्रा का तरीका. जैसे, ड्राइविंग, साइकल चलाना, बस, मेट्रो वगैरह से यात्रा करना या पैदल चलना. इसके अलावा, बस, मेट्रो, ट्रेन, ट्राम या रेल जैसे यात्रा के तरीके भी चुने जा सकते हैं.
Distance Matrix API, शुरुआती और आखिरी पॉइंट के बीच सुझाए गए रास्ते के आधार पर जानकारी देता है. दूरी के इस तरह के डेटा का अनुरोध किया जा सकता है:
चुने गए यात्रा मोड के लिए दूरी
दूरी, किलोमीटर या मील में
ट्रैफ़िक में यात्रा का अनुमानित समय
Distance Matrix API कैसे काम करता है
Distance Matrix API, यात्रा शुरू करने की जगहों और मंज़िलों की संख्या का इस्तेमाल करता है. साथ ही, यह हर जगह और मंज़िल के बीच की दूरी और यात्रा में लगने वाला समय दिखाता है. यह जानकारी, अनुरोध में दी गई पहली जगह से शुरू होती है और एक-एक करके अगली जगह तक जाती है.
उदाहरण के लिए, अगर आपके अनुरोध में A और B को मूल जगह और C और D को मंज़िल के तौर पर तय किया गया है, तो जवाब में दूरी और यात्रा में लगने वाला समय इस क्रम में दिखेगा:
A से C
A से D
B to C
B से D
इस उदाहरण में, दो जगहों (वॉशिंगटन डीसी और बॉस्टन) से न्यूयॉर्क शहर, न्यूयॉर्क तक जाने के लिए अनुरोध दिखाया गया है. यह अनुरोध JSON फ़ॉर्मैट में है:
नीचे दी गई टेबल में, Distance Matrix API के ज़रिए उपलब्ध संसाधनों की खास जानकारी दी गई है. साथ ही, यह भी बताया गया है कि यह एपीआई कौनसा डेटा दिखाता है.
डिस्टेंस मैट्रिक्स एपीआई का इस्तेमाल करके अनुरोध करना
एपीआई कुंजी मिलने के बाद, सीधे अपने ब्राउज़र से Distance Matrix API को टेस्ट किया जा सकता है. उदाहरणों के लिए, शुरू करें गाइड में अनुरोधों के उदाहरण देखें.
3
ज़्यादा मुश्किल अनुरोध लिखना
एक ऐसा अनुरोध करें जिसमें कई मूल स्थान और मंज़िलें शामिल हों. कैलकुलेशन को सीमित करने वाले वैकल्पिक पैरामीटर के बारे में जानें. जैसे, यात्रा शुरू करने का समय या रास्ते से जुड़ी पाबंदियां. डिस्टेंस मैट्रिक्स के अनुरोध और जवाब गाइड में, ज़रूरी नहीं वाले पैरामीटर देखें.
4
जवाब देने से जुड़ी बुनियादी बातें समझना
अपने ऐप्लिकेशन के लिए, डिस्टेंस मैट्रिक्स डेटा का इस्तेमाल करने की तैयारी करने के लिए, डेटा रिस्पॉन्स एक्सप्लोर करें. ज़्यादा जानकारी के लिए, डिस्टेंस मैट्रिक्स रिस्पॉन्स देखें.
5
अपने ऐप्लिकेशन में दूरी के मैट्रिक्स का डेटा शामिल करें!
इस डेटा का इस्तेमाल, यात्रा की दूरी और समय का हिसाब लगाने के लिए किया जा सकता है.
उपलब्ध क्लाइंट लाइब्रेरी
इस एपीआई को अपनी पसंद की भाषा में कॉल करें. इसके लिए, इनमें से किसी एक क्लाइंट लाइब्रेरी का इस्तेमाल करें:
Google Maps Services के लिए Java Client, Python Client, Go Client, और Node.js Client, कम्यूनिटी की ओर से सपोर्ट की जाने वाली क्लाइंट लाइब्रेरी हैं. इन्हें Apache 2.0 License के तहत ओपन सोर्स किया गया है.
इन्हें GitHub से डाउनलोड करें. यहां आपको इंस्टॉल करने के निर्देश और सैंपल कोड भी मिल सकता है.
आगे क्या करना है
Distance Matrix API का इस्तेमाल शुरू करना: शुरू करें पर जाएं.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-09-04 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThe Distance Matrix API calculates travel distance and time between multiple origins and destinations, supporting various modes of transport like driving, biking, transit, or walking.\u003c/p\u003e\n"],["\u003cp\u003eThis API is ideal for optimizing logistics, such as determining efficient delivery routes or assigning workers to job sites based on travel time and distance.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns data in JSON or XML format, providing distance and duration information for each origin-destination pair, including traffic estimations for driving mode.\u003c/p\u003e\n"],["\u003cp\u003eWhile it doesn't provide turn-by-turn directions, you can use the Directions API for detailed route guidance between a single origin and destination.\u003c/p\u003e\n"],["\u003cp\u003eYou can access the Distance Matrix API using client libraries for Java, Python, Go, and Node.js, allowing integration with your applications for custom solutions.\u003c/p\u003e\n"]]],["The Distance Matrix API calculates travel distance and duration between multiple origins and destinations for various transport modes like driving, biking, transit, or walking. It takes an HTTPS request specifying origins and destinations and returns data for each origin-destination pair, in a step-wise fashion. Users can customize requests with parameters like transport mode, units, and departure times, to be used for travel efficiency. The service can return distance, and estimated travel time, including traffic conditions. It supports JSON and XML return format.\n"],null,["# Distance Matrix API 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\nIntroduction\n------------\n\nThe Distance Matrix API (Legacy) is a service that accepts an HTTPS request\ncontaining origins and destinations for a given mode of transport. For each\ncombination of origin and destination, it returns travel distance and duration. \n\nWhy use the Distance Matrix API\n-------------------------------\n\nYou can use the Distance Matrix API to help determine the most efficient\ntravel routes between multiple possible origins and destinations. For\nexample, which workers to send to job sites, or from which warehouses to send\npackages.\n| This API is now in [legacy\n| mode](https://developers.google.com/maps/legacy). Use [Compute Route Matrix](/maps/documentation/routes/compute-route-matrix-over) instead.\n\nWhat you can do with the Distance Matrix API\n--------------------------------------------\n\nWith the Distance Matrix API, you can provide travel distance and time for\na matrix of origins and destinations. You can specify several options, including\nmode of transportation, such as driving, biking, transit or walking, as well as\ntransit modes, such as bus, subway, train, tram, or rail.\n\nThe Distance Matrix API provides information based on the recommended route\nbetween start and end points. You can request these kinds of distance data:\n\n- Distance for a selected travel mode\n- Distance in kilometers or miles\n- Estimated travel time in traffic\n\nHow the Distance Matrix API works\n---------------------------------\n\nThe Distance Matrix API uses any number of origins (starting points) and destinations, and returns the distance and travel time between each\norigin and all requested destinations, starting with the first origin in\nthe request and proceeding step-wise to the next.\n\nFor example, if your request specifies A and B as origins, and C and D as destinations, it returns distances and travel time in this order:\n\n- A to C\n- A to D\n- B to C\n- B to D\n\nThe following example shows a request for two origins:\nWashington, DC and Boston, with a single destination, New York City, NY, in\nJSON format: \n\n```scdoc\nhttps://maps.googleapis.com/maps/api/distancematrix/json\n ?destinations=New%20York%20City%2C%20NY\n &origins=Washington%2C%20DC%7CBoston\n &units=imperial\n &key=YOUR_API_KEY\n```\n\n### Resources\n\nThe following table summarizes the resources available through the\nDistance Matrix API along with the data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| [Distance matrix](/maps/documentation/distance-matrix/distance-matrix) Supply origins and destinations in the form of place IDs, addresses, or latitude/longitude coordinates. | - Distance and travel time between each origin and each destination - Duration in traffic if you've specified the driving mode and a departure time | - JSON - XML |\n\n\u003cbr /\u003e\n\nHow to use the Distance Matrix API\n----------------------------------\n\n|---|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/distance-matrix/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try a distance matrix request** | Once you have an API key, you can start testing out the Distance Matrix API directly from your browser. See [Sample requests](/maps/documentation/distance-matrix/start#sample-request) in the *Get started* guide for examples. |\n| 3 | **Compose a more complex request** | Try a request that supplies multiple origins and destinations. Learn about optional parameters to constrain calculations, such as a specified departure time, or route restrictions. See [Optional parameters](/maps/documentation/distance-matrix/distance-matrix#optional-parameters) in the *Distance Matrix request and response* guide. |\n| 4 | **Understand response basics** | Explore the data responses to prepare to use distance matrix data for your app. See [Distance matrix responses](/maps/documentation/distance-matrix/distance-matrix#distance-matrix-responses) for details. |\n| 5 | **Incorporate distance matrix 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 Distance Matrix** : Go to [Get Started](/maps/documentation/distance-matrix/start).\n- **Get started with sample requests and responses** : Go to [Distance Matrix\n request and response](/maps/documentation/distance-matrix/distance-matrix).\n- **Follow best practices** : Go to [Web Service Best\n Practices](/maps/documentation/distance-matrix/web-service-best-practices)."]]