此产品或功能处于旧版状态。如需详细了解“旧版”阶段以及如何从旧版服务迁移到较新服务,请参阅
旧版产品和功能。
Google आपकी पसंदीदा भाषा में कॉन्टेंट का अनुवाद करने के लिए, एआई टेक्नोलॉजी का इस्तेमाल करता है. एआई से मिले अनुवादों में गलतियां हो सकती हैं.
Distance Matrix API (लेगसी) का इस्तेमाल शुरू करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
अनुरोध और जवाब का उदाहरण
इस उदाहरण में, JSON फ़ॉर्मैट में वॉशिंगटन डीसी और न्यूयॉर्क सिटी, एनवाई के बीच की दूरी के मैट्रिक्स डेटा का अनुरोध किया गया है:
URL
https://maps.googleapis.com/maps/api/distancematrix/json
?destinations=New%20York%20City%2C%20NY
&origins=Washington%2C%20DC
&units=imperial
&key=YOUR_API_KEY
curl
curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Washington%2C%20DC&destinations=New%20York%20City%2C%20NY&units=imperial&key=YOUR_API_KEY'
इसे आज़माएं! वेब ब्राउज़र में यूआरएल डालकर, इस अनुरोध की जांच करें. साथ ही, YOUR_API_KEY को अपनी असली एपीआई
कुंजी से बदलना न भूलें. जवाब में, तय की गई जगहों के बीच की दूरी और लगने वाला समय दिखता है.
अनुरोध के यूआरएल बनाने का तरीका जानें. इसमें उपलब्ध सभी पैरामीटर शामिल हैं.
यह कोड सैंपल, JSON और XML फ़ॉर्मैट में है:
JSON
{
"destination_addresses": ["New York, NY, USA"],
"origin_addresses": ["Washington, DC, USA"],
"rows":
[
{
"elements":
[
{
"distance": { "text": "228 mi", "value": 367654 },
"duration": { "text": "3 hours 55 mins", "value": 14078 },
"status": "OK",
},
],
},
],
"status": "OK",
}
XML
OK
Washington, DC, USA
New York, NY, USA
OK
14078
3 hours 55 mins
367654
228 mi
जवाब को समझने के लिए, डेवलपर की गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2026-07-12 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2026-07-12 (UTC) को अपडेट किया गया."],[],["The content demonstrates requesting distance data between Washington, DC, and New York City using the Google Maps Distance Matrix API. The request URL and cURL command are provided, requiring the user to replace `YOUR_API_KEY` with their own. The API returns distance (228 mi) and duration (3 hours 55 mins) data in both JSON and XML formats. Users can test the URL and further understand responses, and can learn to build custom URL requests through provided documentation.\n"]]