यह प्रॉडक्ट या सुविधा, लेगसी स्टेटस में है. लेगसी स्टेज और लेगसी से नई सेवाओं पर माइग्रेट करने के तरीके के बारे में ज़्यादा जानने के लिए,
लेगसी प्रॉडक्ट और सुविधाएं लेख पढ़ें.
दूरी का मैट्रिक्स एपीआई शुरू करने का तरीका
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
अनुरोध और जवाब का उदाहरण
इस उदाहरण में, 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-03-20 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2026-03-20 (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"]]