দূরত্ব ম্যাট্রিক্স API (উত্তরাধিকার) অনুরোধ এবং প্রতিক্রিয়া

ইউরোপীয় অর্থনৈতিক অঞ্চল (EEA) ডেভেলপাররা

ভূমিকা

একটি ডিস্টেন্স ম্যাট্রিক্স এপিআই (লেগ্যাসি) অনুরোধের রূপটি নিম্নরূপ:

https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters

যেখানে outputFormat নিম্নলিখিত মানগুলির যেকোনো একটি হতে পারে:

  • json (প্রস্তাবিত) মানে হলো জাভাস্ক্রিপ্ট অবজেক্ট নোটেশন (JSON) ফরম্যাটে আউটপুট।
  • xml বলতে আউটপুটকে XML হিসেবে বোঝায়।

কিছু প্যারামিটার আবশ্যক, আবার কিছু ঐচ্ছিক। ইউআরএল-এর প্রচলিত রীতি অনুযায়ী, সমস্ত প্যারামিটার অ্যামপারস্যান্ড ( & ) চিহ্ন দিয়ে আলাদা করা হয়। সমস্ত সংরক্ষিত অক্ষর (যেমন প্লাস চিহ্ন "+") অবশ্যই ইউআরএল-এনকোড করতে হবে। প্যারামিটার এবং তাদের সম্ভাব্য মানগুলির তালিকা নিচে দেওয়া হলো।

প্রয়োজনীয় প্যারামিটার

  • গন্তব্যস্থল

    ভ্রমণের দূরত্ব ও সময় গণনার জন্য সমাপ্তি বিন্দু হিসেবে ব্যবহার করার জন্য এক বা একাধিক অবস্থান। গন্তব্য প্যারামিটারের বিকল্পগুলো উৎস প্যারামিটারের বিকল্পগুলোর মতোই।

  • উৎপত্তি

    ভ্রমণের দূরত্ব ও সময় গণনা করার সূচনা বিন্দু। আপনি পাইপ চিহ্ন (|) দ্বারা পৃথক করা এক বা একাধিক অবস্থান সরবরাহ করতে পারেন, যা একটি স্থানের আইডি, একটি ঠিকানা, অথবা অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক আকারে হতে পারে:

    • স্থান আইডি : আপনি যদি কোনো স্থান আইডি প্রদান করেন, তবে আপনাকে অবশ্যই এর আগে place_id: যোগ করতে হবে।
    • ঠিকানা : আপনি যদি কোনো ঠিকানা দেন, তাহলে পরিষেবাটি স্ট্রিংটিকে জিওকোড করে এবং দূরত্ব গণনা করার জন্য এটিকে একটি অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্কে রূপান্তর করে। এই স্থানাঙ্কটি জিওকোডিং এপিআই দ্বারা প্রাপ্ত স্থানাঙ্ক থেকে ভিন্ন হতে পারে, উদাহরণস্বরূপ, কোনো ভবনের কেন্দ্রের পরিবর্তে তার প্রবেশদ্বার।
      দ্রষ্টব্য: ঠিকানা বা অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করার চেয়ে স্থান আইডি (place ID) ব্যবহার করা শ্রেয়। স্থানাঙ্ক ব্যবহার করলে পয়েন্টটি সর্বদা সেই স্থানাঙ্কের নিকটতম রাস্তায় সংযুক্ত হবে - যা সম্পত্তিতে প্রবেশের পথ নাও হতে পারে, এমনকি এমন কোনো রাস্তাও নাও হতে পারে যা দ্রুত বা নিরাপদে গন্তব্যে নিয়ে যাবে। ঠিকানা ব্যবহার করলে ভবনের প্রবেশপথের পরিবর্তে ভবনের কেন্দ্র পর্যন্ত দূরত্ব পাওয়া যাবে।
    • স্থানাঙ্ক : আপনি যদি অক্ষাংশ/দ্রাঘিমাংশের স্থানাঙ্ক দেন, তবে সেগুলি নিকটতম রাস্তায় স্বয়ংক্রিয়ভাবে চলে যাবে। একটি স্থানের আইডি দেওয়া শ্রেয়। যদি আপনি স্থানাঙ্ক দেন, তবে নিশ্চিত করুন যেন অক্ষাংশ এবং দ্রাঘিমাংশের মানের মধ্যে কোনো ফাঁকা স্থান না থাকে।
    • প্লাস কোড অবশ্যই গ্লোবাল কোড বা কম্পাউন্ড কোড হিসেবে ফরম্যাট করতে হবে। এখানে দেখানো অনুযায়ী প্লাস কোড ফরম্যাট করুন (প্লাস চিহ্নগুলোকে url-escaped করে %2B এবং স্পেসগুলোকে url-escaped করে %20 করা হয়):
      • গ্লোবাল কোড হলো একটি ৪ অক্ষরের এরিয়া কোড এবং ৬ বা তার বেশি অক্ষরের লোকাল কোড (যেমন 849VCWC8+R9 এনকোড হয়ে 849VCWC8%2BR9 হয়)।
      • যৌগিক কোড হলো ৬ বা ততোধিক অক্ষরের একটি স্থানীয় কোড যার সাথে একটি সুস্পষ্ট অবস্থান উল্লেখ থাকে (যেমন: CWC8+R9 Mountain View, CA, USA কে এনকোড করা হয় CWC8%2BR9%20Mountain%20View%20CA%20USA )।
    • বিকল্পভাবে, আপনি এনকোডেড পলিলাইন অ্যালগরিদম ব্যবহার করে স্থানাঙ্কের একটি এনকোডেড সেট সরবরাহ করতে পারেন। এটি বিশেষভাবে উপযোগী যদি আপনার প্রচুর সংখ্যক মূলবিন্দু থাকে, কারণ এনকোডেড পলিলাইন ব্যবহার করলে URL উল্লেখযোগ্যভাবে ছোট হয়।
      • এনকোড করা পলিলাইনের শুরুতে অবশ্যই enc: এবং পরে একটি কোলন : দিতে হবে। উদাহরণস্বরূপ: origins=enc:gfo}EtohhU:
      • আপনি পাইপ ক্যারেক্টার | দ্বারা পৃথক করে একাধিক এনকোডেড পলিলাইনও অন্তর্ভুক্ত করতে পারেন। উদাহরণস্বরূপ:
        origins=enc:wc~oAwquwMdlTxiKtqLyiK:|enc:c~vnAamswMvlTor@tjGi}L:|enc:udymA{~bxM:
        

ঐচ্ছিক পরামিতি

  • আগমনের সময়

    ট্রানজিট দিকনির্দেশনার জন্য পছন্দের পৌঁছানোর সময় নির্দিষ্ট করে, যা ১ জানুয়ারী, ১৯৭০ UTC-এর মধ্যরাত থেকে সেকেন্ডে পরিমাপ করা হয়। আপনি departure_time অথবা arrival_time মধ্যে যেকোনো একটি নির্দিষ্ট করতে পারেন, কিন্তু উভয়ই নয়। মনে রাখবেন যে arrival_time অবশ্যই একটি পূর্ণসংখ্যা হিসাবে নির্দিষ্ট করতে হবে।

  • এড়িয়ে চলুন

    নির্দিষ্ট কিছু সীমাবদ্ধতা মেনে দূরত্ব গণনা করা যেতে পারে। ‘avoid’ প্যারামিটার এবং সেই প্যারামিটারের একটি আর্গুমেন্ট ব্যবহার করে সীমাবদ্ধতাগুলো নির্দেশ করা হয়, যা পরিহারযোগ্য সীমাবদ্ধতাটি নির্দেশ করে। নিম্নলিখিত সীমাবদ্ধতাগুলো সমর্থিত:

    • tolls নির্দেশ করে যে, গণনা করা পথটিতে টোল রাস্তা/সেতু এড়িয়ে চলতে হবে।
    • highways নির্দেশ করে যে, গণনা করা পথটি হাইওয়ে এড়িয়ে চলবে।
    • ferries নির্দেশ করে যে গণনা করা পথটিতে ফেরি এড়িয়ে চলতে হবে।
    • indoor নির্দেশ করে যে, গণনা করা পথটিতে হাঁটা এবং গণপরিবহনের দিকনির্দেশনার জন্য বাড়ির ভেতরের সিঁড়ি এড়িয়ে চলতে হবে।

    `avoid` প্যারামিটারে উভয় সীমাবদ্ধতা পাস করার মাধ্যমে টোল, হাইওয়ে এবং ফেরির যেকোনো সংমিশ্রণ এড়িয়ে চলে এমন একটি রুটের অনুরোধ করা সম্ভব। উদাহরণস্বরূপ, avoid=tolls|highways|ferries

    দ্রষ্টব্য: বিধিনিষেধ যোগ করার ফলে সেইসব রুট বাদ পড়ে না যেগুলিতে সীমাবদ্ধ বৈশিষ্ট্যটি অন্তর্ভুক্ত রয়েছে; এটি ফলাফলকে আরও অনুকূল রুটের দিকে পক্ষপাতদুষ্ট করে তোলে।
  • প্রস্থানের সময়

    প্রস্থানের পছন্দের সময় নির্দিষ্ট করে। আপনি ১ জানুয়ারী, ১৯৭০ UTC মধ্যরাত থেকে সেকেন্ডে একটি পূর্ণসংখ্যা হিসাবে সময়টি নির্দিষ্ট করতে পারেন। যদি 9999-12-31T23:59:59.999999999Z-এর চেয়ে পরবর্তী কোনো departure_time নির্দিষ্ট করা হয়, তাহলে API departure_time 9999-12-31T23:59:59.999999999Z-এ ফিরিয়ে নিয়ে যাবে। বিকল্পভাবে, আপনি 'now' মানটি নির্দিষ্ট করতে পারেন, যা প্রস্থানের সময়কে বর্তমান সময়ে (নিকটতম সেকেন্ড পর্যন্ত সঠিক) সেট করে। প্রস্থানের সময় দুটি ক্ষেত্রে নির্দিষ্ট করা যেতে পারে:

    • যেসব অনুরোধের ভ্রমণ মাধ্যম গণপরিবহন, সেগুলোর ক্ষেত্রে আপনি ঐচ্ছিকভাবে departure_time ) অথবা arrival_time ) এর মধ্যে যেকোনো একটি নির্দিষ্ট করতে পারেন। যদি কোনো সময়ই নির্দিষ্ট করা না হয়, তাহলে departure_time ডিফল্টভাবে বর্তমান সময় হবে (অর্থাৎ, যাত্রার সময় ডিফল্টভাবে বর্তমান সময় হবে)।
    • যেসব অনুরোধের জন্য ভ্রমণের মাধ্যম গাড়ি, সেগুলোর ক্ষেত্রে আপনি একটি রুট এবং ভ্রমণের সময়কাল (রেসপন্স ফিল্ড: duration_in_traffic) পাওয়ার জন্য departure_time নির্দিষ্ট করতে পারেন, যা ট্র্যাফিকের অবস্থা বিবেচনা করে। departure_time অবশ্যই বর্তমান সময় বা ভবিষ্যতের কোনো সময়ে সেট করতে হবে। এটি অতীতের কোনো সময় হতে পারবে না।
    দ্রষ্টব্য: প্রস্থানের সময় নির্দিষ্ট করা না থাকলে, রুটের পছন্দ এবং যাত্রার সময়কাল সড়ক নেটওয়ার্ক এবং সময়-নিরপেক্ষ গড় ট্র্যাফিক পরিস্থিতির উপর ভিত্তি করে নির্ধারিত হয়। সড়ক নেটওয়ার্কের পরিবর্তন, হালনাগাদকৃত গড় ট্র্যাফিক পরিস্থিতি এবং পরিষেবার বিকেন্দ্রীভূত প্রকৃতির কারণে একটি নির্দিষ্ট অনুরোধের ফলাফল সময়ের সাথে সাথে পরিবর্তিত হতে পারে। যেকোনো সময়ে বা যেকোনো পুনরাবৃত্তিতে প্রায়-সমতুল্য রুটগুলোর মধ্যেও ফলাফল ভিন্ন হতে পারে।
    দ্রষ্টব্য: mode=driving অবস্থায় departure_time উল্লেখ করে করা Distance Matrix অনুরোধগুলি প্রতি অনুরোধে সর্বোচ্চ ১০০টি উপাদানের মধ্যে সীমাবদ্ধ। উৎসের সংখ্যা এবং গন্তব্যের সংখ্যার গুণফলই উপাদানের সংখ্যা নির্ধারণ করে।
  • ভাষা

    যে ভাষায় ফলাফল ফেরত দেওয়া হয়।

    • সমর্থিত ভাষাগুলোর তালিকা দেখুন। গুগল প্রায়শই সমর্থিত ভাষাগুলো হালনাগাদ করে, তাই এই তালিকাটি সম্পূর্ণ নাও হতে পারে।
    • যদি language সরবরাহ করা না হয়, তাহলে API-টি Accept-Language হেডারে নির্দিষ্ট করা পছন্দের ভাষাটি ব্যবহার করার চেষ্টা করে।
    • এপিআইটি ব্যবহারকারী এবং স্থানীয় বাসিন্দা উভয়ের জন্য পাঠযোগ্য একটি রাস্তার ঠিকানা প্রদান করার জন্য যথাসাধ্য চেষ্টা করে। সেই লক্ষ্য অর্জনের জন্য, এটি পছন্দের ভাষাটি অনুসরণ করে রাস্তার ঠিকানাগুলো স্থানীয় ভাষায় ফেরত দেয় এবং প্রয়োজনে ব্যবহারকারীর পাঠযোগ্য লিপিতে তা প্রতিবর্ণীকরণ করে। অন্য সব ঠিকানা পছন্দের ভাষাতেই ফেরত দেওয়া হয়। ঠিকানার সমস্ত উপাদান একই ভাষায় ফেরত দেওয়া হয়, যা প্রথম উপাদানটি থেকে বেছে নেওয়া হয়।
    • পছন্দের ভাষায় কোনো নাম উপলব্ধ না থাকলে, এপিআই সবচেয়ে কাছাকাছি মিল থাকা নামটি ব্যবহার করে।
    • এপিআই যে ফলাফলগুলো ফেরত দেবে এবং সেগুলো যে ক্রমে ফেরত আসবে, তার ওপর পছন্দের ভাষার সামান্য প্রভাব রয়েছে। জিওকোডার ভাষার ওপর নির্ভর করে সংক্ষিপ্ত রূপগুলোকে ভিন্নভাবে ব্যাখ্যা করে, যেমন রাস্তার প্রকারভেদের সংক্ষিপ্ত রূপ, অথবা এমন সমার্থক শব্দ যা একটি ভাষায় বৈধ হলেও অন্যটিতে নয়। উদাহরণস্বরূপ, হাঙ্গেরীয় ভাষায় 'utca' এবং 'tér' হলো রাস্তার সমার্থক শব্দ।
  • মোড

    দূরত্ব ও দিক গণনার জন্য, আপনি কোন পরিবহন মাধ্যম ব্যবহার করবেন তা নির্দিষ্ট করে দিতে পারেন। ডিফল্টরূপে, DRIVING মোড ব্যবহৃত হয়। ডিফল্টরূপে, দিকনির্দেশগুলো ড্রাইভিং দিকনির্দেশ হিসেবে গণনা করা হয়। নিম্নলিখিত ভ্রমণ মাধ্যমগুলো সমর্থিত:

    • driving (ডিফল্ট) সড়ক নেটওয়ার্ক ব্যবহার করে সাধারণ ড্রাইভিং দিকনির্দেশনা বা দূরত্ব নির্দেশ করে।
    • walking অনুরোধ, পথচারী পথ ও ফুটপাত (যেখানে উপলব্ধ) ব্যবহার করে হাঁটার দিকনির্দেশনা বা দূরত্ব।
    • bicycling বাইসাইকেল পথ ও পছন্দের রাস্তা (যেখানে উপলব্ধ) ব্যবহার করে দিকনির্দেশনা বা দূরত্বের অনুরোধ।
    • transit পাবলিক ট্রানজিট রুট ব্যবহার করে (যেখানে উপলব্ধ) দিকনির্দেশনা বা দূরত্বের অনুরোধ করে। আপনি যদি মোডটি ট্রানজিট হিসেবে সেট করেন, তাহলে আপনি ঐচ্ছিকভাবে একটি departure_time (departure_time) অথবা একটি আগমনের সময় ( arrival_time ) নির্দিষ্ট করতে পারেন। যদি কোনো সময়ই নির্দিষ্ট না করা হয়, তাহলে departure_time সময় ডিফল্টভাবে বর্তমান সময় হবে। আপনি ঐচ্ছিকভাবে একটি transit_mode ) এবং/অথবা একটি transit_routing_preference ) অন্তর্ভুক্ত করতে পারেন।
    দ্রষ্টব্য: হাঁটা এবং সাইকেল চালানোর দিকনির্দেশনায় অনেক সময় পথচারী বা সাইকেল চালানোর জন্য স্পষ্ট পথ অন্তর্ভুক্ত নাও থাকতে পারে, তাই এই দিকনির্দেশনাগুলো প্রাপ্ত ফলাফলে সতর্কবার্তা দেখাবে যা আপনাকে অবশ্যই ব্যবহারকারীকে প্রদর্শন করতে হবে।
    দ্রষ্টব্য: ডেটা সরবরাহকারীদের দেওয়া ট্রানজিট তথ্যের প্রাপ্যতার উপর নির্ভর করে, ট্রানজিট ট্রিপের তথ্য সর্বোচ্চ বিগত ৭ দিন বা সর্বোচ্চ ভবিষ্যৎ ১০০ দিনের জন্য উপলব্ধ থাকবে। ট্রানজিটের সময়সূচী ঘন ঘন পরিবর্তিত হয়, সময়ের সাথে সাথে উপলব্ধ ট্রানজিট ট্রিপের সংখ্যাও পরিবর্তিত হতে পারে এবং অনেক আগে থেকে করা পূর্বাভাসের ক্ষেত্রে ধারাবাহিক ফলাফল প্রদানের কোনো নিশ্চয়তা নেই।
  • অঞ্চল

    অঞ্চল কোডটি একটি ccTLD ("টপ-লেভেল ডোমেইন") দুই-অক্ষরের মান হিসাবে নির্দিষ্ট করা হয়। কিছু উল্লেখযোগ্য ব্যতিক্রম ছাড়া, বেশিরভাগ ccTLD কোড ISO 3166-1 কোডের অনুরূপ। উদাহরণস্বরূপ, যুক্তরাজ্যের ccTLD হলো "uk" (.co.uk), যেখানে এর ISO 3166-1 কোড হলো "gb" (যা প্রযুক্তিগতভাবে "দ্য ইউনাইটেড কিংডম অফ গ্রেট ব্রিটেন অ্যান্ড নর্দার্ন আয়ারল্যান্ড" সত্তাটির জন্য ব্যবহৃত হয়)।

  • ট্র্যাফিক_মডেল

    ট্র্যাফিকের মধ্যে কাটানো সময় গণনা করার জন্য যে অনুমানগুলি ব্যবহার করা হবে, তা নির্দিষ্ট করে। এই সেটিংটি রেসপন্সের duration_in_traffic ফিল্ডে ফেরত আসা মানকে প্রভাবিত করে, যেখানে ঐতিহাসিক গড়ের উপর ভিত্তি করে ট্র্যাফিকের মধ্যে আনুমানিক সময় থাকে। traffic_model প্যারামিটারটি শুধুমাত্র সেইসব ড্রাইভিং নির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে, যেখানে অনুরোধে একটি departure_time অন্তর্ভুক্ত থাকে। এই প্যারামিটারের জন্য উপলব্ধ মানগুলি হলো:

    • best_guess (ডিফল্ট) নির্দেশ করে যে, ঐতিহাসিক এবং চলমান ট্র্যাফিক পরিস্থিতি সম্পর্কে যা জানা আছে, তার ভিত্তিতে ফেরত আসা duration_in_traffic ভ্রমণ সময়ের সর্বোত্তম অনুমান হওয়া উচিত। departure_time বর্তমান সময়ের যত কাছাকাছি হবে, চলমান ট্র্যাফিক তত বেশি গুরুত্বপূর্ণ হয়ে উঠবে।
    • pessimistic বলতে বোঝায় যে, ফেরত আসা `duration_in_traffic` বেশিরভাগ দিনেই প্রকৃত ভ্রমণ সময়ের চেয়ে বেশি হওয়া উচিত, যদিও বিশেষ করে খারাপ ট্র্যাফিক পরিস্থিতির কারণে মাঝে মাঝে এই মান অতিক্রম করতে পারে।
    • optimistic নির্দেশ করে যে, ফেরত আসা `duration_in_traffic` বেশিরভাগ দিনেই প্রকৃত ভ্রমণ সময়ের চেয়ে কম হওয়া উচিত, যদিও বিশেষ ভালো ট্র্যাফিক পরিস্থিতিযুক্ত কিছু ব্যতিক্রমী দিনে এটি এই মানের চেয়ে দ্রুত হতে পারে।

    best_guess এর ডিফল্ট মানটি অধিকাংশ ব্যবহারের ক্ষেত্রেই সবচেয়ে কার্যকর পূর্বাভাস দেবে। best_guess পূর্বাভাস মডেলটি যেভাবে লাইভ ট্র্যাফিকের তথ্য অন্তর্ভুক্ত করে, তার কারণে best_guess ভ্রমণ সময়ের পূর্বাভাসটি optimistic পূর্বাভাসের চেয়ে কম, অথবা pessimistic পূর্বাভাসের চেয়ে বেশি হতে পারে।

  • ট্রানজিট_মোড

    এক বা একাধিক পছন্দের পরিবহন মাধ্যম নির্দিষ্ট করে। এই প্যারামিটারটি শুধুমাত্র পরিবহনের দিকনির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে। প্যারামিটারটি নিম্নলিখিত আর্গুমেন্টগুলো সমর্থন করে:

    • bus নির্দেশ করে যে, গণনা করা রুটটিতে বাসে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • subway নির্দেশ করে যে, গণনাকৃত রুটটিতে সাবওয়েতে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • train নির্দেশ করে যে, গণনা করা রুটটিতে ট্রেনে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • tram নির্দেশ করে যে, গণনাকৃত রুটে ট্রাম এবং লাইট রেলে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • rail নির্দেশ করে যে, গণনাকৃত রুটে ট্রেন, ট্রাম, লাইট রেল এবং সাবওয়েতে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত। এটি transit_mode=train|tram|subway এর সমতুল্য।
  • ট্রানজিট_রাউটিং_পছন্দ

    গণপরিবহন রুটের জন্য পছন্দ নির্দিষ্ট করে। এই প্যারামিটারটি ব্যবহার করে, আপনি এপিআই দ্বারা নির্বাচিত ডিফল্ট সেরা রুটটি গ্রহণ না করে, ফেরত আসা বিকল্পগুলোকে নিজের পছন্দ অনুযায়ী বেছে নিতে পারেন। এই প্যারামিটারটি শুধুমাত্র গণপরিবহনের দিকনির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে। প্যারামিটারটি নিম্নলিখিত আর্গুমেন্টগুলো সমর্থন করে:

    • less_walking নির্দেশ করে যে, গণনা করা পথটিতে সীমিত হাঁটাচলাকে অগ্রাধিকার দেওয়া উচিত।
    • fewer_transfers নির্দেশ করে যে, গণনাকৃত রুটটি সীমিত সংখ্যক ট্রান্সফারকে অগ্রাধিকার দেবে।
  • ইউনিট

    ফলাফল প্রদর্শনের জন্য ব্যবহৃত একক পদ্ধতি নির্দিষ্ট করে।

    দ্রষ্টব্য: এই একক পদ্ধতি সেটিংটি শুধুমাত্র দূরত্বের ফিল্ডের মধ্যে প্রদর্শিত লেখাকে প্রভাবিত করে। দূরত্বের ফিল্ডগুলিতে এমন মানও থাকে যা সর্বদা মিটারে প্রকাশ করা হয়।

উদাহরণ অনুরোধ করুন

এই উদাহরণে গন্তব্যের স্থানাঙ্ক নির্দিষ্ট করতে অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করা হয়েছে:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626&key=YOUR_API_KEY'

এই উদাহরণে গন্তব্যের স্থানাঙ্ক নির্দিষ্ট করতে প্লাস কোড ব্যবহার করা হয়েছে:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco
  &origins=849VCWC8%2BR9
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=849VCWC8%2BR9&destinations=San%20Francisco&key=YOUR_API_KEY'

এই উদাহরণটি একটি এনকোডেড পলিলাইন ব্যবহার করে একই অনুরোধটি দেখাচ্ছে:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A&key=YOUR_API_KEY'

ট্র্যাফিক তথ্য

যখন নিম্নলিখিত সবগুলি প্রযোজ্য হয় তখন ট্র্যাফিকের তথ্য ব্যবহার করা হয় (ডিস্টেন্স ম্যাট্রিক্স রেসপন্সে duration_in_traffic ফিল্ডটি পাওয়ার জন্য এই শর্তগুলি প্রয়োজন):

  • ভ্রমণ mode প্যারামিটারটি driving , অথবা নির্দিষ্ট করা নেই ( driving হলো ডিফল্ট ভ্রমণ মোড)।
  • অনুরোধটিতে একটি বৈধ departure_time প্যারামিটার অন্তর্ভুক্ত রয়েছে। ' departure_time বর্তমান সময় বা ভবিষ্যতের কোনো সময়ে সেট করা যেতে পারে। এটি অতীতের কোনো সময় হতে পারে না।

ঐচ্ছিকভাবে, ট্র্যাফিকের সময় গণনা করার জন্য ব্যবহৃত অনুমানগুলি নির্দিষ্ট করতে আপনি আপনার অনুরোধে traffic_model প্যারামিটারটি অন্তর্ভুক্ত করতে পারেন।

নিম্নলিখিত URL-টি বস্টন, এমএ বা চার্লসটাউন, এমএ এবং লেক্সিংটন, এমএ ও কনকর্ড, এমএ-এর মধ্যে ড্রাইভিং দূরত্ব নির্ণয়ের জন্য একটি ডিস্ট্যান্স ম্যাট্রিক্স অনুরোধ শুরু করে। অনুরোধটিতে একটি প্রস্থানের সময় অন্তর্ভুক্ত থাকে, যা ডিস্ট্যান্স ম্যাট্রিক্স প্রতিক্রিয়ায় duration_in_traffic ফিল্ডটি ফেরত দেওয়ার জন্য সমস্ত প্রয়োজনীয়তা পূরণ করে।

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?departure_time=now
  &destinations=Lexington%2CMA%7CConcord%2CMA
  &origins=Boston%2CMA%7CCharlestown%2CMA
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Boston%2CMA%7CCharlestown%2CMA&destinations=Lexington%2CMA%7CConcord%2CMA&departure_time=now&key=YOUR_API_KEY'

JSON

{
  "destination_addresses": ["Lexington, MA, USA", "Concord, MA, USA"],
  "origin_addresses": ["Boston, MA, USA", "Charlestown, Boston, MA, USA"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "33.3 km", "value": 33253 },
              "duration": { "text": "27 mins", "value": 1620 },
              "duration_in_traffic": { "text": "34 mins", "value": 2019 },
              "status": "OK",
            },
            {
              "distance": { "text": "41.5 km", "value": 41491 },
              "duration": { "text": "33 mins", "value": 1981 },
              "duration_in_traffic": { "text": "39 mins", "value": 2342 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "31.1 km", "value": 31100 },
              "duration": { "text": "26 mins", "value": 1543 },
              "duration_in_traffic": { "text": "29 mins", "value": 1754 },
              "status": "OK",
            },
            {
              "distance": { "text": "39.3 km", "value": 39338 },
              "duration": { "text": "32 mins", "value": 1904 },
              "duration_in_traffic": { "text": "35 mins", "value": 2077 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

এক্সএমএল


 OK
 Boston, MA, USA
 Charlestown, Boston, MA, USA
 Lexington, MA, USA
 Concord, MA, USA
 
  
   OK
   
    1620
    27 mins
   
   
    33253
    33.3 km
   
   
    2018
    34 mins
   
  
  
   OK
   
    1981
    33 mins
   
   
    41491
    41.5 km
   
   
    2342
    39 mins
   
  
 
 
  
   OK
   
    1543
    26 mins
   
   
    31100
    31.1 km
   
   
    1759
    29 mins
   
  
  
   OK
   
    1904
    32 mins
   
   
    39338
    39.3 km
   
   
    2077
    35 mins
   
  
 

অবস্থান পরিবর্তনকারী

চালকদের কোনো নির্দিষ্ট স্থানে কীভাবে পৌঁছাতে হবে, তা নির্দেশ করার জন্য আপনি লোকেশন মডিফায়ার ব্যবহার করতে পারেন। এর জন্য আপনি side_of_road মডিফায়ার ব্যবহার করে রাস্তার কোন পাশ ব্যবহার করতে হবে তা নির্দিষ্ট করতে পারেন, অথবা ভ্রমণের সঠিক দিক নির্দেশ করার জন্য একটি হেডিং উল্লেখ করতে পারেন।

নির্দিষ্ট করুন যে গণনাকৃত পথ অবশ্যই রাস্তার একটি নির্দিষ্ট পাশ দিয়ে যেতে হবে।

কোনো অবস্থান নির্দিষ্ট করার সময়, আপনি ` side_of_road: প্রিফিক্সটি ব্যবহার করে অনুরোধ করতে পারেন যেন গণনা করা রুটটি রাস্তার সেই পাশ দিয়ে যায় যেদিকে ওয়েপয়েন্টটি ঝুঁকে আছে। উদাহরণস্বরূপ, এই অনুরোধটি একটি দীর্ঘ রুটের দূরত্ব ফেরত দেবে, যাতে যানবাহনটি রাস্তার সেই পাশে গিয়ে থামে যেদিকে ওয়েপয়েন্টটি ঝুঁকে ছিল:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3A37.7663444%2C-122.4412006
  &origins=37.7680296%2C-122.4375126
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=37.7680296%2C-122.4375126&destinations=side_of_road%3A37.7663444%2C-122.4412006&key=YOUR_API_KEY'

এনকোডেড পলিলাইনের সাথে side_of_road: ব্যবহার করার সময়, মডিফায়ারটি পলিলাইন বরাবর প্রতিটি অবস্থানে প্রয়োগ করা হয়। উদাহরণস্বরূপ, এই অনুরোধের দুটি গন্তব্যই এই প্যারামিটারটি ব্যবহার করে:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A
  &origins=San%20Francisco%20City%20hall
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=San%20Francisco%20City%20hall&destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A&key=YOUR_API_KEY'

` side_of_road: ` মডিফায়ারটি শুধুমাত্র এই সীমাবদ্ধতার সাথে ব্যবহার করা যেতে পারে:

নির্দিষ্ট করুন যে গণনাকৃত রুটগুলির একটি নির্দিষ্ট শিরোনাম থাকবে।

কোনো অবস্থান নির্দিষ্ট করার সময়, আপনি অনুরোধ করতে পারেন যে গণনা করা রুটটি একটি নির্দিষ্ট হেডিং বরাবর সেই অবস্থানের মধ্য দিয়ে যাবে। এই হেডিংটি heading=X: প্রিফিক্স দিয়ে নির্দিষ্ট করা হয়, যেখানে X হলো ০ (অন্তর্ভুক্ত) এবং ৩৬০ (বর্জনীয়)-এর মধ্যে একটি পূর্ণসংখ্যা। হেডিং ০ উত্তর দিক নির্দেশ করে, ৯০ পূর্ব দিক নির্দেশ করে এবং এটি ঘড়ির কাঁটার দিকে চলতে থাকে। উদাহরণস্বরূপ, এই অনুরোধে গণনা করা রুটটি মূলবিন্দু থেকে পূর্ব দিকে যায়, তারপর একটি ইউ-টার্ন নেয়:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=37.773245%2C-122.469502
  &origins=heading%3D90%3A37.773279%2C-122.468780
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=heading%3D90%3A37.773279%2C-122.468780&destinations=37.773245%2C-122.469502&key=YOUR_API_KEY'

` heading=X: ` মডিফায়ারটি শুধুমাত্র নিম্নলিখিত বিধিনিষেধ সাপেক্ষে ব্যবহার করা যাবে:

  • ভ্রমণ mode প্যারামিটারটি হলো driving , bicycling , অথবা এটি নির্দিষ্ট করা নেই ( driving হলো ডিফল্ট ভ্রমণ মোড)।
  • একই অবস্থানের জন্য side_of_road মডিফায়ারটি নির্দিষ্ট করা হয়নি।
  • অবস্থানটি অক্ষাংশ/দ্রাঘিমাংশের মান দিয়ে নির্দিষ্ট করা হয়। আপনি ঠিকানা, স্থান আইডি বা এনকোডেড পলিলাইনের সাথে heading ব্যবহার করতে পারবেন না।

দূরত্ব ম্যাট্রিক্স অনুরোধ এবং প্রতিক্রিয়া

নিচে একটি নমুনা HTTP অনুরোধ দেখানো হলো, যেখানে কানাডার ভ্যাঙ্কুভার, বিসি এবং মার্কিন যুক্তরাষ্ট্রের সিয়াটল, ডব্লিউএ থেকে মার্কিন যুক্তরাষ্ট্রের সান ফ্রান্সিসকো, সিএ এবং কানাডার ভিক্টোরিয়া, বিসি পর্যন্ত দূরত্ব এবং সময়কাল জানতে চাওয়া হয়েছে।

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco%7CVictoria%20BC
  &language=fr-FR
  &mode=bicycling
  &origins=Vancouver%20BC%7CSeattle
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver%20BC%7CSeattle&destinations=San%20Francisco%7CVictoria%20BC&mode=bicycling&language=fr-FR&key=YOUR_API_KEY'

এই অনুরোধটি চারটি উপাদান ফেরত দেবে - দুটি উৎস গুণ দুটি গন্তব্য:

ভ্যাঙ্কুভার থেকে সান ফ্রান্সিসকো ভ্যাঙ্কুভার থেকে ভিক্টোরিয়া
সিয়াটল থেকে সান ফ্রান্সিসকো সিয়াটল থেকে ভিক্টোরিয়া

ফলাফলগুলো সারি আকারে ফেরত দেওয়া হয়, প্রতিটি সারিতে একটি করে উৎসের সাথে প্রতিটি গন্তব্য যুক্ত থাকে।

JSON

{
  "destination_addresses":
    ["San Francisco, Californie, États-Unis", "Victoria, BC, Canada"],
  "origin_addresses":
    ["Vancouver, BC, Canada", "Seattle, Washington, États-Unis"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "1 712 km", "value": 1711765 },
              "duration": { "text": "3 jours 16 heures", "value": 318119 },
              "status": "OK",
            },
            {
              "distance": { "text": "140 km", "value": 139695 },
              "duration": { "text": "6 heures 49 minutes", "value": 24567 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "1 452 km", "value": 1451704 },
              "duration": { "text": "3 jours 2 heures", "value": 266680 },
              "status": "OK",
            },
            {
              "distance": { "text": "146 km", "value": 146500 },
              "duration": { "text": "2 heures 53 minutes", "value": 10374 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

এক্সএমএল


 OK
 Vancouver, BC, Canada
 Seattle, Washington, États-Unis
 San Francisco, Californie, États-Unis
 Victoria, BC, Canada
 
  
   OK
   
    318119
    3 jours 16 heures
   
   
    1711765
    1712 km
   
  
  
   OK
   
    24567
    6 heures 49 minutes
   
   
    139695
    140 km
   
  
 
 
  
   OK
   
    266680
    3 jours 2 heures
   
   
    1451704
    1452 km
   
  
  
   OK
   
    10374
    2 heures 53 minutes
   
   
    146500
    146 km
   
  
 

দূরত্বম্যাট্রিক্স প্রতিক্রিয়া

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় অ্যারে<স্ট্রিং>

আপনার মূল অনুরোধ থেকে এপিআই দ্বারা ফেরত আসা ঠিকানাগুলির একটি অ্যারে। origin_addresses এর মতোই, প্রয়োজন অনুসারে এগুলি স্থানীয়করণ করা হয়। এই বিষয়বস্তুটি সরাসরি পড়ার জন্য। প্রোগ্রামগতভাবে এই ফরম্যাট করা ঠিকানাগুলি পার্স করবেন না।

প্রয়োজনীয় অ্যারে<স্ট্রিং>

আপনার মূল অনুরোধ থেকে এপিআই দ্বারা ফেরত আসা ঠিকানাগুলির একটি অ্যারে। এগুলি জিওকোডার দ্বারা ফরম্যাট করা হয় এবং অনুরোধের সাথে পাঠানো ভাষা প্যারামিটার অনুযায়ী স্থানীয়করণ করা হয়। এই বিষয়বস্তুটি সরাসরি পড়ার জন্য। প্রোগ্রামগতভাবে ফরম্যাট করা ঠিকানাগুলি পার্স করবেন না।

প্রয়োজনীয় অ্যারে< দূরত্বম্যাট্রিক্সসারি >

উপাদানগুলির একটি অ্যারে, যার প্রতিটিতে আবার একটি status , duration এবং distance উপাদান থাকে।

আরও তথ্যের জন্য DistanceMatrixRow দেখুন।

প্রয়োজনীয় দূরত্বম্যাট্রিক্স স্থিতি

এতে অনুরোধের অবস্থা থাকে এবং অনুরোধটি কেন ব্যর্থ হয়েছে তা খুঁজে বের করতে সাহায্য করার জন্য ডিবাগিং তথ্যও থাকতে পারে।

আরও তথ্যের জন্য DistanceMatrixStatus দেখুন।

ঐচ্ছিক স্ট্রিং

অনুরোধটি প্রক্রিয়াকরণের সময় উদ্ভূত যেকোনো ত্রুটির পাঠযোগ্য বিবরণ সম্বলিত একটি স্ট্রিং।

দূরত্বম্যাট্রিক্স স্থিতি

পরিষেবা দ্বারা ফেরত দেওয়া স্ট্যাটাস কোড।

  • OK নির্দেশ করে যে প্রতিক্রিয়াটিতে একটি বৈধ ফলাফল রয়েছে।
  • INVALID_REQUEST নির্দেশ করে যে প্রদত্ত অনুরোধটি অবৈধ ছিল।
  • MAX_ELEMENTS_EXCEEDED নির্দেশ করে যে উৎস এবং গন্তব্যের গুণফল প্রতি-কোয়েরি সীমা অতিক্রম করেছে।
  • MAX_DIMENSIONS_EXCEEDED নির্দেশ করে যে উৎস বা গন্তব্যের সংখ্যা প্রতি-কোয়েরি সীমা অতিক্রম করেছে।
  • OVER_DAILY_LIMIT নিম্নলিখিত যেকোনো একটিকে নির্দেশ করে:
    • এপিআই কী অনুপস্থিত অথবা অবৈধ।
    • আপনার অ্যাকাউন্টে বিলিং চালু করা হয়নি।
    • স্বেচ্ছায় নির্ধারিত ব্যবহারের সীমা অতিক্রম করা হয়েছে।
    • প্রদত্ত অর্থপ্রদানের পদ্ধতিটি আর বৈধ নয় (উদাহরণস্বরূপ, ক্রেডিট কার্ডের মেয়াদ শেষ হয়ে গেছে)।
  • OVER_QUERY_LIMIT নির্দেশ করে যে, পরিষেবাটি নির্ধারিত সময়সীমার মধ্যে আপনার অ্যাপ্লিকেশন থেকে প্রয়োজনের চেয়ে বেশি অনুরোধ পেয়েছে।
  • REQUEST_DENIED নির্দেশ করে যে পরিষেবাটি আপনার অ্যাপ্লিকেশনকে ডিস্টেন্স ম্যাট্রিক্স পরিষেবা ব্যবহার করতে দেয়নি।
  • UNKNOWN_ERROR নির্দেশ করে যে সার্ভার ত্রুটির কারণে একটি ডিস্ট্যান্স ম্যাট্রিক্স অনুরোধ প্রক্রিয়া করা যায়নি। আপনি পুনরায় চেষ্টা করলে অনুরোধটি সফল হতে পারে।

দূরত্বম্যাট্রিক্স সারি

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় অ্যারে< দূরত্বম্যাট্রিক্সউপাদান >

যখন ডিস্ট্যান্স ম্যাট্রিক্স এপিআই ফলাফল ফেরত দেয়, তখন সেগুলোকে একটি JSON রো অ্যারের মধ্যে রাখে। এমনকি যদি কোনো ফলাফল ফেরত না আসে (যেমন যখন উৎস এবং/অথবা গন্তব্য বিদ্যমান থাকে না), তখনও এটি একটি খালি অ্যারে ফেরত দেয়।

অনুরোধের 'অরিজিন' প্যারামিটারের মান অনুসারে সারিগুলো সাজানো হয়। প্রতিটি সারি একটি অরিজিনকে নির্দেশ করে, এবং সেই সারির প্রতিটি উপাদান অরিজিন ও ডেস্টিনেশন মানের একটি জোড়কে নির্দেশ করে।

প্রতিটি সারি অ্যারেতে এক বা একাধিক উপাদান এন্ট্রি থাকে, যেগুলোতে আবার একটিমাত্র উৎস-গন্তব্য জোড়া সম্পর্কিত তথ্য থাকে।

আরও তথ্যের জন্য DistanceMatrixElement দেখুন।

দূরত্বম্যাট্রিক্স উপাদান

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় দূরত্বম্যাট্রিক্স উপাদান স্থিতি

উপাদানটির একটি অবস্থা।

আরও তথ্যের জন্য DistanceMatrixElementStatus দেখুন।

ঐচ্ছিক টেক্সটভ্যালুঅবজেক্ট

এই রুটের মোট দূরত্ব, যা মিটারে (মান) এবং পাঠ্য আকারে প্রকাশ করা হয়। পাঠ্য মানটি মূল অনুরোধের ইউনিট প্যারামিটারে নির্দিষ্ট করা ইউনিট সিস্টেম, অথবা উৎসের অঞ্চল ব্যবহার করে।

আরও তথ্যের জন্য TextValueObject দেখুন।

ঐচ্ছিক টেক্সটভ্যালুঅবজেক্ট

এই পথটি অতিক্রম করতে যে সময় লাগে, তা সেকেন্ডে (ভ্যালু ফিল্ড) এবং টেক্সট হিসেবে প্রকাশ করা হয়। কোয়েরির ল্যাঙ্গুয়েজ প্যারামিটার অনুযায়ী টেক্সচুয়াল উপস্থাপনাটি স্থানীয়করণ করা হয়।

আরও তথ্যের জন্য TextValueObject দেখুন।

ঐচ্ছিক টেক্সটভ্যালুঅবজেক্ট

বর্তমান এবং ঐতিহাসিক ট্র্যাফিকের অবস্থার উপর ভিত্তি করে এই রুটটি অতিক্রম করতে যে সময় লাগে। ফেরত আসা মানটি আশাবাদী, হতাশাবাদী, বা একটি সম্ভাব্য সেরা অনুমান হবে কিনা, তা অনুরোধ করার জন্য আপনি যে বিকল্পগুলি ব্যবহার করতে পারেন, তার জন্য traffic_model অনুরোধ প্যারামিটারটি দেখুন। সময়কালটি সেকেন্ডে (value ফিল্ডে) এবং টেক্সট হিসাবে প্রকাশ করা হয়। পাঠ্য উপস্থাপনাটি কোয়েরির language প্যারামিটার অনুযায়ী স্থানীয়করণ করা হয়। ট্র্যাফিকের সময়কালটি কেবল তখনই ফেরত দেওয়া হয় যদি নিম্নলিখিত সবগুলি সত্য হয়:

  • অনুরোধটিতে একটি departure_time প্যারামিটার অন্তর্ভুক্ত রয়েছে।
  • অনুরোধকৃত রুটের জন্য ট্র্যাফিকের অবস্থা উপলব্ধ আছে।
  • মোড প্যারামিটারটি ড্রাইভিং-এ সেট করা আছে।

আরও তথ্যের জন্য TextValueObject দেখুন।

ঐচ্ছিক ভাড়া

উপস্থিত থাকলে, এতে এই রুটের মোট ভাড়া (অর্থাৎ, টিকিটের মোট খরচ) থাকে। এই বৈশিষ্ট্যটি শুধুমাত্র ট্রানজিট অনুরোধের জন্য এবং শুধুমাত্র সেইসব ট্রানজিট প্রদানকারীদের জন্য ফেরত দেওয়া হয়, যাদের ভাড়ার তথ্য উপলব্ধ আছে।

আরও তথ্যের জন্য ভাড়া দেখুন।

ভাড়া

এই রুটের মোট ভাড়া।

{
  "currency" : "USD",
  "value" : 6,
  "text" : "$6.00"
}
মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

একটি ISO 4217 মুদ্রা কোড যা নির্দেশ করে যে টাকার পরিমাণটি কোন মুদ্রায় প্রকাশ করা হয়েছে।

প্রয়োজনীয় স্ট্রিং

অনুরোধকৃত ভাষায় মোট ভাড়ার পরিমাণ।

প্রয়োজনীয় সংখ্যা

মোট ভাড়ার পরিমাণ, নির্দিষ্ট মুদ্রায়।

দূরত্বম্যাট্রিক্স উপাদান স্থিতি

  • OK নির্দেশ করে যে প্রতিক্রিয়াটিতে একটি বৈধ ফলাফল রয়েছে।
  • NOT_FOUND নির্দেশ করে যে এই জোড়াটির উৎস এবং/অথবা গন্তব্য জিওকোড করা যায়নি।
  • ZERO_RESULTS নির্দেশ করে যে উৎস এবং গন্তব্যের মধ্যে কোনো রুট খুঁজে পাওয়া যায়নি।
  • MAX_ROUTE_LENGTH_EXCEEDED নির্দেশ করে যে অনুরোধ করা রুটটি খুব দীর্ঘ এবং এটি প্রক্রিয়া করা যাবে না।

টেক্সটভ্যালুঅবজেক্ট

একটি অবজেক্ট, যাতে একটি সাংখ্যিক মান এবং তার ফরম্যাট করা পাঠ্য উপস্থাপনা থাকে।

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

স্ট্রিং মান।

প্রয়োজনীয় সংখ্যা

সংখ্যাসূচক মান।

,
ইউরোপীয় অর্থনৈতিক অঞ্চল (EEA) ডেভেলপাররা

ভূমিকা

একটি ডিস্টেন্স ম্যাট্রিক্স এপিআই (লেগ্যাসি) অনুরোধের রূপটি নিম্নরূপ:

https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters

যেখানে outputFormat নিম্নলিখিত মানগুলির যেকোনো একটি হতে পারে:

  • json (প্রস্তাবিত) মানে হলো জাভাস্ক্রিপ্ট অবজেক্ট নোটেশন (JSON) ফরম্যাটে আউটপুট।
  • xml বলতে আউটপুটকে XML হিসেবে বোঝায়।

কিছু প্যারামিটার আবশ্যক, আবার কিছু ঐচ্ছিক। ইউআরএল-এর প্রচলিত রীতি অনুযায়ী, সমস্ত প্যারামিটার অ্যামপারস্যান্ড ( & ) চিহ্ন দিয়ে আলাদা করা হয়। সমস্ত সংরক্ষিত অক্ষর (যেমন প্লাস চিহ্ন "+") অবশ্যই ইউআরএল-এনকোড করতে হবে। প্যারামিটার এবং তাদের সম্ভাব্য মানগুলির তালিকা নিচে দেওয়া হলো।

প্রয়োজনীয় প্যারামিটার

  • গন্তব্যস্থল

    ভ্রমণের দূরত্ব ও সময় গণনার জন্য সমাপ্তি বিন্দু হিসেবে ব্যবহার করার জন্য এক বা একাধিক অবস্থান। গন্তব্য প্যারামিটারের বিকল্পগুলো উৎস প্যারামিটারের বিকল্পগুলোর মতোই।

  • উৎপত্তি

    ভ্রমণের দূরত্ব ও সময় গণনা করার সূচনা বিন্দু। আপনি পাইপ চিহ্ন (|) দ্বারা পৃথক করা এক বা একাধিক অবস্থান সরবরাহ করতে পারেন, যা একটি স্থানের আইডি, একটি ঠিকানা, অথবা অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক আকারে হতে পারে:

    • স্থান আইডি : আপনি যদি কোনো স্থান আইডি প্রদান করেন, তবে আপনাকে অবশ্যই এর আগে place_id: যোগ করতে হবে।
    • ঠিকানা : আপনি যদি কোনো ঠিকানা দেন, তাহলে পরিষেবাটি স্ট্রিংটিকে জিওকোড করে এবং দূরত্ব গণনা করার জন্য এটিকে একটি অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্কে রূপান্তর করে। এই স্থানাঙ্কটি জিওকোডিং এপিআই দ্বারা প্রাপ্ত স্থানাঙ্ক থেকে ভিন্ন হতে পারে, উদাহরণস্বরূপ, কোনো ভবনের কেন্দ্রের পরিবর্তে তার প্রবেশদ্বার।
      দ্রষ্টব্য: ঠিকানা বা অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করার চেয়ে স্থান আইডি (place ID) ব্যবহার করা শ্রেয়। স্থানাঙ্ক ব্যবহার করলে পয়েন্টটি সর্বদা সেই স্থানাঙ্কের নিকটতম রাস্তায় সংযুক্ত হবে - যা সম্পত্তিতে প্রবেশের পথ নাও হতে পারে, এমনকি এমন কোনো রাস্তাও নাও হতে পারে যা দ্রুত বা নিরাপদে গন্তব্যে নিয়ে যাবে। ঠিকানা ব্যবহার করলে ভবনের প্রবেশপথের পরিবর্তে ভবনের কেন্দ্র পর্যন্ত দূরত্ব পাওয়া যাবে।
    • স্থানাঙ্ক : আপনি যদি অক্ষাংশ/দ্রাঘিমাংশের স্থানাঙ্ক দেন, তবে সেগুলি নিকটতম রাস্তায় স্বয়ংক্রিয়ভাবে চলে যাবে। একটি স্থানের আইডি দেওয়া শ্রেয়। যদি আপনি স্থানাঙ্ক দেন, তবে নিশ্চিত করুন যেন অক্ষাংশ এবং দ্রাঘিমাংশের মানের মধ্যে কোনো ফাঁকা স্থান না থাকে।
    • প্লাস কোড অবশ্যই গ্লোবাল কোড বা কম্পাউন্ড কোড হিসেবে ফরম্যাট করতে হবে। এখানে দেখানো অনুযায়ী প্লাস কোড ফরম্যাট করুন (প্লাস চিহ্নগুলোকে url-escaped করে %2B এবং স্পেসগুলোকে url-escaped করে %20 করা হয়):
      • গ্লোবাল কোড হলো একটি ৪ অক্ষরের এরিয়া কোড এবং ৬ বা তার বেশি অক্ষরের লোকাল কোড (যেমন 849VCWC8+R9 এনকোড হয়ে 849VCWC8%2BR9 হয়)।
      • যৌগিক কোড হলো ৬ বা ততোধিক অক্ষরের একটি স্থানীয় কোড যার সাথে একটি সুস্পষ্ট অবস্থান উল্লেখ থাকে (যেমন: CWC8+R9 Mountain View, CA, USA কে এনকোড করা হয় CWC8%2BR9%20Mountain%20View%20CA%20USA )।
    • বিকল্পভাবে, আপনি এনকোডেড পলিলাইন অ্যালগরিদম ব্যবহার করে স্থানাঙ্কের একটি এনকোডেড সেট সরবরাহ করতে পারেন। এটি বিশেষভাবে উপযোগী যদি আপনার প্রচুর সংখ্যক মূলবিন্দু থাকে, কারণ এনকোডেড পলিলাইন ব্যবহার করলে URL উল্লেখযোগ্যভাবে ছোট হয়।
      • এনকোড করা পলিলাইনের শুরুতে অবশ্যই enc: এবং পরে একটি কোলন : দিতে হবে। উদাহরণস্বরূপ: origins=enc:gfo}EtohhU:
      • আপনি পাইপ ক্যারেক্টার | দ্বারা পৃথক করে একাধিক এনকোডেড পলিলাইনও অন্তর্ভুক্ত করতে পারেন। উদাহরণস্বরূপ:
        origins=enc:wc~oAwquwMdlTxiKtqLyiK:|enc:c~vnAamswMvlTor@tjGi}L:|enc:udymA{~bxM:
        

ঐচ্ছিক পরামিতি

  • আগমনের সময়

    ট্রানজিট দিকনির্দেশনার জন্য পছন্দের পৌঁছানোর সময় নির্দিষ্ট করে, যা ১ জানুয়ারী, ১৯৭০ UTC-এর মধ্যরাত থেকে সেকেন্ডে পরিমাপ করা হয়। আপনি departure_time অথবা arrival_time মধ্যে যেকোনো একটি নির্দিষ্ট করতে পারেন, কিন্তু উভয়ই নয়। মনে রাখবেন যে arrival_time অবশ্যই একটি পূর্ণসংখ্যা হিসাবে নির্দিষ্ট করতে হবে।

  • এড়িয়ে চলুন

    নির্দিষ্ট কিছু সীমাবদ্ধতা মেনে দূরত্ব গণনা করা যেতে পারে। ‘avoid’ প্যারামিটার এবং সেই প্যারামিটারের একটি আর্গুমেন্ট ব্যবহার করে সীমাবদ্ধতাগুলো নির্দেশ করা হয়, যা পরিহারযোগ্য সীমাবদ্ধতাটি নির্দেশ করে। নিম্নলিখিত সীমাবদ্ধতাগুলো সমর্থিত:

    • tolls নির্দেশ করে যে, গণনা করা পথটিতে টোল রাস্তা/সেতু এড়িয়ে চলতে হবে।
    • highways নির্দেশ করে যে, গণনা করা পথটি হাইওয়ে এড়িয়ে চলবে।
    • ferries নির্দেশ করে যে গণনা করা পথটিতে ফেরি এড়িয়ে চলতে হবে।
    • indoor নির্দেশ করে যে, গণনা করা পথটিতে হাঁটা এবং গণপরিবহনের দিকনির্দেশনার জন্য বাড়ির ভেতরের সিঁড়ি এড়িয়ে চলতে হবে।

    `avoid` প্যারামিটারে উভয় সীমাবদ্ধতা পাস করার মাধ্যমে টোল, হাইওয়ে এবং ফেরির যেকোনো সংমিশ্রণ এড়িয়ে চলে এমন একটি রুটের অনুরোধ করা সম্ভব। উদাহরণস্বরূপ, avoid=tolls|highways|ferries

    দ্রষ্টব্য: বিধিনিষেধ যোগ করার ফলে সেইসব রুট বাদ পড়ে না যেগুলিতে সীমাবদ্ধ বৈশিষ্ট্যটি অন্তর্ভুক্ত রয়েছে; এটি ফলাফলকে আরও অনুকূল রুটের দিকে পক্ষপাতদুষ্ট করে তোলে।
  • প্রস্থানের সময়

    প্রস্থানের পছন্দের সময় নির্দিষ্ট করে। আপনি ১ জানুয়ারী, ১৯৭০ UTC মধ্যরাত থেকে সেকেন্ডে একটি পূর্ণসংখ্যা হিসাবে সময়টি নির্দিষ্ট করতে পারেন। যদি 9999-12-31T23:59:59.999999999Z-এর চেয়ে পরবর্তী কোনো departure_time নির্দিষ্ট করা হয়, তাহলে API departure_time 9999-12-31T23:59:59.999999999Z-এ ফিরিয়ে নিয়ে যাবে। বিকল্পভাবে, আপনি 'now' মানটি নির্দিষ্ট করতে পারেন, যা প্রস্থানের সময়কে বর্তমান সময়ে (নিকটতম সেকেন্ড পর্যন্ত সঠিক) সেট করে। প্রস্থানের সময় দুটি ক্ষেত্রে নির্দিষ্ট করা যেতে পারে:

    • যেসব অনুরোধের ভ্রমণ মাধ্যম গণপরিবহন, সেগুলোর ক্ষেত্রে আপনি ঐচ্ছিকভাবে departure_time ) অথবা arrival_time ) এর মধ্যে যেকোনো একটি নির্দিষ্ট করতে পারেন। যদি কোনো সময়ই নির্দিষ্ট করা না হয়, তাহলে departure_time ডিফল্টভাবে বর্তমান সময় হবে (অর্থাৎ, যাত্রার সময় ডিফল্টভাবে বর্তমান সময় হবে)।
    • যেসব অনুরোধের জন্য ভ্রমণের মাধ্যম গাড়ি, সেগুলোর ক্ষেত্রে আপনি একটি রুট এবং ভ্রমণের সময়কাল (রেসপন্স ফিল্ড: duration_in_traffic) পাওয়ার জন্য departure_time নির্দিষ্ট করতে পারেন, যা ট্র্যাফিকের অবস্থা বিবেচনা করে। departure_time অবশ্যই বর্তমান সময় বা ভবিষ্যতের কোনো সময়ে সেট করতে হবে। এটি অতীতের কোনো সময় হতে পারবে না।
    দ্রষ্টব্য: প্রস্থানের সময় নির্দিষ্ট করা না থাকলে, রুটের পছন্দ এবং যাত্রার সময়কাল সড়ক নেটওয়ার্ক এবং সময়-নিরপেক্ষ গড় ট্র্যাফিক পরিস্থিতির উপর ভিত্তি করে নির্ধারিত হয়। সড়ক নেটওয়ার্কের পরিবর্তন, হালনাগাদকৃত গড় ট্র্যাফিক পরিস্থিতি এবং পরিষেবার বিকেন্দ্রীভূত প্রকৃতির কারণে একটি নির্দিষ্ট অনুরোধের ফলাফল সময়ের সাথে সাথে পরিবর্তিত হতে পারে। যেকোনো সময়ে বা যেকোনো পুনরাবৃত্তিতে প্রায়-সমতুল্য রুটগুলোর মধ্যেও ফলাফল ভিন্ন হতে পারে।
    দ্রষ্টব্য: mode=driving অবস্থায় departure_time উল্লেখ করে করা Distance Matrix অনুরোধগুলি প্রতি অনুরোধে সর্বোচ্চ ১০০টি উপাদানের মধ্যে সীমাবদ্ধ। উৎসের সংখ্যা এবং গন্তব্যের সংখ্যার গুণফলই উপাদানের সংখ্যা নির্ধারণ করে।
  • ভাষা

    যে ভাষায় ফলাফল ফেরত দেওয়া হয়।

    • সমর্থিত ভাষাগুলোর তালিকা দেখুন। গুগল প্রায়শই সমর্থিত ভাষাগুলো হালনাগাদ করে, তাই এই তালিকাটি সম্পূর্ণ নাও হতে পারে।
    • যদি language সরবরাহ করা না হয়, তাহলে API-টি Accept-Language হেডারে নির্দিষ্ট করা পছন্দের ভাষাটি ব্যবহার করার চেষ্টা করে।
    • এপিআইটি ব্যবহারকারী এবং স্থানীয় বাসিন্দা উভয়ের জন্য পাঠযোগ্য একটি রাস্তার ঠিকানা প্রদান করার জন্য যথাসাধ্য চেষ্টা করে। সেই লক্ষ্য অর্জনের জন্য, এটি পছন্দের ভাষাটি অনুসরণ করে রাস্তার ঠিকানাগুলো স্থানীয় ভাষায় ফেরত দেয় এবং প্রয়োজনে ব্যবহারকারীর পাঠযোগ্য লিপিতে তা প্রতিবর্ণীকরণ করে। অন্য সব ঠিকানা পছন্দের ভাষাতেই ফেরত দেওয়া হয়। ঠিকানার সমস্ত উপাদান একই ভাষায় ফেরত দেওয়া হয়, যা প্রথম উপাদানটি থেকে বেছে নেওয়া হয়।
    • পছন্দের ভাষায় কোনো নাম উপলব্ধ না থাকলে, এপিআই সবচেয়ে কাছাকাছি মিল থাকা নামটি ব্যবহার করে।
    • এপিআই যে ফলাফলগুলো ফেরত দেবে এবং সেগুলো যে ক্রমে ফেরত আসবে, তার ওপর পছন্দের ভাষার সামান্য প্রভাব রয়েছে। জিওকোডার ভাষার ওপর নির্ভর করে সংক্ষিপ্ত রূপগুলোকে ভিন্নভাবে ব্যাখ্যা করে, যেমন রাস্তার প্রকারভেদের সংক্ষিপ্ত রূপ, অথবা এমন সমার্থক শব্দ যা একটি ভাষায় বৈধ হলেও অন্যটিতে নয়। উদাহরণস্বরূপ, হাঙ্গেরীয় ভাষায় 'utca' এবং 'tér' হলো রাস্তার সমার্থক শব্দ।
  • মোড

    দূরত্ব ও দিক গণনার জন্য, আপনি কোন পরিবহন মাধ্যম ব্যবহার করবেন তা নির্দিষ্ট করে দিতে পারেন। ডিফল্টরূপে, DRIVING মোড ব্যবহৃত হয়। ডিফল্টরূপে, দিকনির্দেশগুলো ড্রাইভিং দিকনির্দেশ হিসেবে গণনা করা হয়। নিম্নলিখিত ভ্রমণ মাধ্যমগুলো সমর্থিত:

    • driving (ডিফল্ট) সড়ক নেটওয়ার্ক ব্যবহার করে সাধারণ ড্রাইভিং দিকনির্দেশনা বা দূরত্ব নির্দেশ করে।
    • walking অনুরোধ, পথচারী পথ ও ফুটপাত (যেখানে উপলব্ধ) ব্যবহার করে হাঁটার দিকনির্দেশনা বা দূরত্ব।
    • bicycling বাইসাইকেল পথ ও পছন্দের রাস্তা (যেখানে উপলব্ধ) ব্যবহার করে দিকনির্দেশনা বা দূরত্বের অনুরোধ।
    • transit পাবলিক ট্রানজিট রুট ব্যবহার করে (যেখানে উপলব্ধ) দিকনির্দেশনা বা দূরত্বের অনুরোধ করে। আপনি যদি মোডটি ট্রানজিট হিসেবে সেট করেন, তাহলে আপনি ঐচ্ছিকভাবে একটি departure_time (departure_time) অথবা একটি আগমনের সময় ( arrival_time ) নির্দিষ্ট করতে পারেন। যদি কোনো সময়ই নির্দিষ্ট না করা হয়, তাহলে departure_time সময় ডিফল্টভাবে বর্তমান সময় হবে। আপনি ঐচ্ছিকভাবে একটি transit_mode ) এবং/অথবা একটি transit_routing_preference ) অন্তর্ভুক্ত করতে পারেন।
    দ্রষ্টব্য: হাঁটা এবং সাইকেল চালানোর দিকনির্দেশনায় অনেক সময় পথচারী বা সাইকেল চালানোর জন্য স্পষ্ট পথ অন্তর্ভুক্ত নাও থাকতে পারে, তাই এই দিকনির্দেশনাগুলো প্রাপ্ত ফলাফলে সতর্কবার্তা দেখাবে যা আপনাকে অবশ্যই ব্যবহারকারীকে প্রদর্শন করতে হবে।
    দ্রষ্টব্য: ডেটা সরবরাহকারীদের দেওয়া ট্রানজিট তথ্যের প্রাপ্যতার উপর নির্ভর করে, ট্রানজিট ট্রিপের তথ্য সর্বোচ্চ বিগত ৭ দিন বা সর্বোচ্চ ভবিষ্যৎ ১০০ দিনের জন্য উপলব্ধ থাকবে। ট্রানজিটের সময়সূচী ঘন ঘন পরিবর্তিত হয়, সময়ের সাথে সাথে উপলব্ধ ট্রানজিট ট্রিপের সংখ্যাও পরিবর্তিত হতে পারে এবং অনেক আগে থেকে করা পূর্বাভাসের ক্ষেত্রে ধারাবাহিক ফলাফল প্রদানের কোনো নিশ্চয়তা নেই।
  • অঞ্চল

    অঞ্চল কোডটি একটি ccTLD ("টপ-লেভেল ডোমেইন") দুই-অক্ষরের মান হিসাবে নির্দিষ্ট করা হয়। কিছু উল্লেখযোগ্য ব্যতিক্রম ছাড়া, বেশিরভাগ ccTLD কোড ISO 3166-1 কোডের অনুরূপ। উদাহরণস্বরূপ, যুক্তরাজ্যের ccTLD হলো "uk" (.co.uk), যেখানে এর ISO 3166-1 কোড হলো "gb" (যা প্রযুক্তিগতভাবে "দ্য ইউনাইটেড কিংডম অফ গ্রেট ব্রিটেন অ্যান্ড নর্দার্ন আয়ারল্যান্ড" সত্তাটির জন্য ব্যবহৃত হয়)।

  • ট্র্যাফিক_মডেল

    ট্র্যাফিকের মধ্যে কাটানো সময় গণনা করার জন্য যে অনুমানগুলি ব্যবহার করা হবে, তা নির্দিষ্ট করে। এই সেটিংটি রেসপন্সের duration_in_traffic ফিল্ডে ফেরত আসা মানকে প্রভাবিত করে, যেখানে ঐতিহাসিক গড়ের উপর ভিত্তি করে ট্র্যাফিকের মধ্যে আনুমানিক সময় থাকে। traffic_model প্যারামিটারটি শুধুমাত্র সেইসব ড্রাইভিং নির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে, যেখানে অনুরোধে একটি departure_time অন্তর্ভুক্ত থাকে। এই প্যারামিটারের জন্য উপলব্ধ মানগুলি হলো:

    • best_guess (ডিফল্ট) নির্দেশ করে যে, ঐতিহাসিক এবং চলমান ট্র্যাফিক পরিস্থিতি সম্পর্কে যা জানা আছে, তার ভিত্তিতে ফেরত আসা duration_in_traffic ভ্রমণ সময়ের সর্বোত্তম অনুমান হওয়া উচিত। departure_time বর্তমান সময়ের যত কাছাকাছি হবে, চলমান ট্র্যাফিক তত বেশি গুরুত্বপূর্ণ হয়ে উঠবে।
    • pessimistic বলতে বোঝায় যে, ফেরত আসা `duration_in_traffic` বেশিরভাগ দিনেই প্রকৃত ভ্রমণ সময়ের চেয়ে বেশি হওয়া উচিত, যদিও বিশেষ করে খারাপ ট্র্যাফিক পরিস্থিতির কারণে মাঝে মাঝে এই মান অতিক্রম করতে পারে।
    • optimistic নির্দেশ করে যে, ফেরত আসা `duration_in_traffic` বেশিরভাগ দিনেই প্রকৃত ভ্রমণ সময়ের চেয়ে কম হওয়া উচিত, যদিও বিশেষ ভালো ট্র্যাফিক পরিস্থিতিযুক্ত কিছু ব্যতিক্রমী দিনে এটি এই মানের চেয়ে দ্রুত হতে পারে।

    best_guess এর ডিফল্ট মানটি অধিকাংশ ব্যবহারের ক্ষেত্রেই সবচেয়ে কার্যকর পূর্বাভাস দেবে। best_guess পূর্বাভাস মডেলটি যেভাবে লাইভ ট্র্যাফিকের তথ্য অন্তর্ভুক্ত করে, তার কারণে best_guess ভ্রমণ সময়ের পূর্বাভাসটি optimistic পূর্বাভাসের চেয়ে কম, অথবা pessimistic পূর্বাভাসের চেয়ে বেশি হতে পারে।

  • ট্রানজিট_মোড

    এক বা একাধিক পছন্দের পরিবহন মাধ্যম নির্দিষ্ট করে। এই প্যারামিটারটি শুধুমাত্র পরিবহনের দিকনির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে। প্যারামিটারটি নিম্নলিখিত আর্গুমেন্টগুলো সমর্থন করে:

    • bus নির্দেশ করে যে, গণনা করা রুটটিতে বাসে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • subway নির্দেশ করে যে, গণনাকৃত রুটটিতে সাবওয়েতে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • train নির্দেশ করে যে, গণনা করা রুটটিতে ট্রেনে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • tram নির্দেশ করে যে, গণনাকৃত রুটে ট্রাম এবং লাইট রেলে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত।
    • rail নির্দেশ করে যে, গণনাকৃত রুটে ট্রেন, ট্রাম, লাইট রেল এবং সাবওয়েতে ভ্রমণকে অগ্রাধিকার দেওয়া উচিত। এটি transit_mode=train|tram|subway এর সমতুল্য।
  • ট্রানজিট_রাউটিং_পছন্দ

    গণপরিবহন রুটের জন্য পছন্দ নির্দিষ্ট করে। এই প্যারামিটারটি ব্যবহার করে, আপনি এপিআই দ্বারা নির্বাচিত ডিফল্ট সেরা রুটটি গ্রহণ না করে, ফেরত আসা বিকল্পগুলোকে নিজের পছন্দ অনুযায়ী বেছে নিতে পারেন। এই প্যারামিটারটি শুধুমাত্র গণপরিবহনের দিকনির্দেশনার জন্য নির্দিষ্ট করা যেতে পারে। প্যারামিটারটি নিম্নলিখিত আর্গুমেন্টগুলো সমর্থন করে:

    • less_walking নির্দেশ করে যে, গণনা করা পথটিতে সীমিত হাঁটাচলাকে অগ্রাধিকার দেওয়া উচিত।
    • fewer_transfers নির্দেশ করে যে, গণনাকৃত রুটটি সীমিত সংখ্যক ট্রান্সফারকে অগ্রাধিকার দেবে।
  • ইউনিট

    ফলাফল প্রদর্শনের জন্য ব্যবহৃত একক পদ্ধতি নির্দিষ্ট করে।

    দ্রষ্টব্য: এই একক পদ্ধতি সেটিংটি শুধুমাত্র দূরত্বের ফিল্ডের মধ্যে প্রদর্শিত লেখাকে প্রভাবিত করে। দূরত্বের ফিল্ডগুলিতে এমন মানও থাকে যা সর্বদা মিটারে প্রকাশ করা হয়।

উদাহরণ অনুরোধ করুন

এই উদাহরণে গন্তব্যের স্থানাঙ্ক নির্দিষ্ট করতে অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করা হয়েছে:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626&key=YOUR_API_KEY'

This example uses plus codes to specify the destination coordinates:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco
  &origins=849VCWC8%2BR9
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=849VCWC8%2BR9&destinations=San%20Francisco&key=YOUR_API_KEY'

This example shows the same request using an encoded polyline:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A&key=YOUR_API_KEY'

Traffic information

Traffic information is used when all the following apply (these are the conditions required to receive the duration_in_traffic field in the Distance Matrix response):

  • The travel mode parameter is driving , or is not specified ( driving is the default travel mode).
  • The request includes a valid departure_time parameter . The departure_time can be set to the current time or some time in the future. It cannot be in the past.

Optionally, you can include the traffic_model parameter in your request to specify the assumptions to use when calculating time in traffic.

The following URL initiates a Distance Matrix request for driving distances between Boston, MA or Charlestown, MA, and Lexington, MA and Concord, MA. The request includes a departure time, meeting all the requirements to return the duration_in_traffic field in the Distance Matrix response.

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?departure_time=now
  &destinations=Lexington%2CMA%7CConcord%2CMA
  &origins=Boston%2CMA%7CCharlestown%2CMA
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Boston%2CMA%7CCharlestown%2CMA&destinations=Lexington%2CMA%7CConcord%2CMA&departure_time=now&key=YOUR_API_KEY'

JSON

{
  "destination_addresses": ["Lexington, MA, USA", "Concord, MA, USA"],
  "origin_addresses": ["Boston, MA, USA", "Charlestown, Boston, MA, USA"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "33.3 km", "value": 33253 },
              "duration": { "text": "27 mins", "value": 1620 },
              "duration_in_traffic": { "text": "34 mins", "value": 2019 },
              "status": "OK",
            },
            {
              "distance": { "text": "41.5 km", "value": 41491 },
              "duration": { "text": "33 mins", "value": 1981 },
              "duration_in_traffic": { "text": "39 mins", "value": 2342 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "31.1 km", "value": 31100 },
              "duration": { "text": "26 mins", "value": 1543 },
              "duration_in_traffic": { "text": "29 mins", "value": 1754 },
              "status": "OK",
            },
            {
              "distance": { "text": "39.3 km", "value": 39338 },
              "duration": { "text": "32 mins", "value": 1904 },
              "duration_in_traffic": { "text": "35 mins", "value": 2077 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

XML


 OK
 Boston, MA, USA
 Charlestown, Boston, MA, USA
 Lexington, MA, USA
 Concord, MA, USA
 
  
   OK
   
    1620
    27 mins
   
   
    33253
    33.3 km
   
   
    2018
    34 mins
   
  
  
   OK
   
    1981
    33 mins
   
   
    41491
    41.5 km
   
   
    2342
    39 mins
   
  
 
 
  
   OK
   
    1543
    26 mins
   
   
    31100
    31.1 km
   
   
    1759
    29 mins
   
  
  
   OK
   
    1904
    32 mins
   
   
    39338
    39.3 km
   
   
    2077
    35 mins
   
  
 

Location Modifiers

You can use location modifiers to indicate how drivers should approach a particular location, by using the side_of_road modifier to specify which side of the road to use, or by specifying a heading to indicate the correct direction of travel.

Specify that calculated routes must pass through a particular side of the road

When specifying a location, you can request that the calculated route go through whichever side of the road the waypoint is biased towards by using the side_of_road: prefix. For example, this request will return the distance for a long route so that the vehicle ends on the side of the road to which the waypoint was biased:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3A37.7663444%2C-122.4412006
  &origins=37.7680296%2C-122.4375126
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=37.7680296%2C-122.4375126&destinations=side_of_road%3A37.7663444%2C-122.4412006&key=YOUR_API_KEY'

When using side_of_road: with encoded polylines, the modifier is applied to every location along the polyline. For example, the two destinations in this request both use the parameter:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A
  &origins=San%20Francisco%20City%20hall
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=San%20Francisco%20City%20hall&destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A&key=YOUR_API_KEY'

The side_of_road: modifier may only be used with this restriction:

  • The travel mode parameter is driving , or is not specified ( driving is the default travel mode).

Specify that calculated routes should have a particular heading

When specifying a location, you can request that the calculated route go through the location in a particular heading. This heading is specified with the prefix heading=X: , where X is an integer degree value between 0 (inclusive) and 360 (exclusive). A heading of 0 indicates North, 90 indicates East, continuing clockwise. For example, in this request the calculated route goes east from the origin, then takes a U-turn:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=37.773245%2C-122.469502
  &origins=heading%3D90%3A37.773279%2C-122.468780
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=heading%3D90%3A37.773279%2C-122.468780&destinations=37.773245%2C-122.469502&key=YOUR_API_KEY'

The heading=X: modifier may only be used with these restrictions:

  • The travel mode parameter is driving , bicycling , or is not specified ( driving is the default travel mode).
  • The side_of_road modifier is not specified for the same location.
  • The location is specified with a latitude/longitude value. You may not use heading with addresses, Place IDs, or encoded polylines.

Distance Matrix request and responses

A sample HTTP request is shown below, requesting distance and duration from Vancouver, BC, Canada and from Seattle, WA, USA, to San Francisco, CA, USA and to Victoria, BC, Canada.

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco%7CVictoria%20BC
  &language=fr-FR
  &mode=bicycling
  &origins=Vancouver%20BC%7CSeattle
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver%20BC%7CSeattle&destinations=San%20Francisco%7CVictoria%20BC&mode=bicycling&language=fr-FR&key=YOUR_API_KEY'

This request will return four elements - two origins times two destinations:

Vancouver to San Francisco Vancouver to Victoria
Seattle to San Francisco Seattle to Victoria

Results are returned in rows, each row containing one origin paired with each destination.

JSON

{
  "destination_addresses":
    ["San Francisco, Californie, États-Unis", "Victoria, BC, Canada"],
  "origin_addresses":
    ["Vancouver, BC, Canada", "Seattle, Washington, États-Unis"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "1 712 km", "value": 1711765 },
              "duration": { "text": "3 jours 16 heures", "value": 318119 },
              "status": "OK",
            },
            {
              "distance": { "text": "140 km", "value": 139695 },
              "duration": { "text": "6 heures 49 minutes", "value": 24567 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "1 452 km", "value": 1451704 },
              "duration": { "text": "3 jours 2 heures", "value": 266680 },
              "status": "OK",
            },
            {
              "distance": { "text": "146 km", "value": 146500 },
              "duration": { "text": "2 heures 53 minutes", "value": 10374 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

XML


 OK
 Vancouver, BC, Canada
 Seattle, Washington, États-Unis
 San Francisco, Californie, États-Unis
 Victoria, BC, Canada
 
  
   OK
   
    318119
    3 jours 16 heures
   
   
    1711765
    1712 km
   
  
  
   OK
   
    24567
    6 heures 49 minutes
   
   
    139695
    140 km
   
  
 
 
  
   OK
   
    266680
    3 jours 2 heures
   
   
    1451704
    1452 km
   
  
  
   OK
   
    10374
    2 heures 53 minutes
   
   
    146500
    146 km
   
  
 

DistanceMatrixResponse

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় Array<string>

An array of addresses as returned by the API from your original request. As with origin_addresses , these are localized if appropriate. This content is meant to be read as-is. Don't programmatically parse the formatted addresses.

প্রয়োজনীয় Array<string>

An array of addresses as returned by the API from your original request. These are formatted by the geocoder and localized according to the language parameter passed with the request. This content is meant to be read as-is. Don't programmatically parse the formatted addresses.

প্রয়োজনীয় Array< DistanceMatrixRow >

An array of elements, which in turn each contain a status , duration , and distance element.

See DistanceMatrixRow for more information.

প্রয়োজনীয় DistanceMatrixStatus

Contains the status of the request, and may contain debugging information to help you track down why the request failed.

See DistanceMatrixStatus for more information.

ঐচ্ছিক স্ট্রিং

A string containing the human-readable text of any errors encountered while the request was being processed.

DistanceMatrixStatus

Status codes returned by service.

  • OK indicates the response contains a valid result.
  • INVALID_REQUEST indicates that the provided request was invalid.
  • MAX_ELEMENTS_EXCEEDED indicates that the product of origins and destinations exceeds the per-query limit.
  • MAX_DIMENSIONS_EXCEEDED indicates that the number of origins or destinations exceeds the per-query limit.
  • OVER_DAILY_LIMIT indicates any of the following:
    • The API key is missing or invalid.
    • Billing has not been enabled on your account.
    • A self-imposed usage cap has been exceeded.
    • The provided method of payment is no longer valid (for example, a credit card has expired).
  • OVER_QUERY_LIMIT indicates the service has received too many requests from your application within the allowed time period.
  • REQUEST_DENIED indicates that the service denied use of the Distance Matrix service by your application.
  • UNKNOWN_ERROR indicates a Distance Matrix request couldn't be processed due to a server error. The request may succeed if you try again.

DistanceMatrixRow

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় Array< DistanceMatrixElement >

When the Distance Matrix API returns results, it places them within a JSON rows array. Even if no results are returned (such as when the origins and/or destinations don't exist), it still returns an empty array.

Rows are ordered according to the values in the origin parameter of the request. Each row corresponds to an origin, and each element within that row corresponds to a pairing of the origin with a destination value.

Each row array contains one or more element entries, which in turn contain the information about a single origin-destination pairing.

See DistanceMatrixElement for more information.

DistanceMatrixElement

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় DistanceMatrixElementStatus

A status for the element.

See DistanceMatrixElementStatus for more information.

ঐচ্ছিক TextValueObject

The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the unit parameter of the original request, or the origin's region.

See TextValueObject for more information.

ঐচ্ছিক TextValueObject

The length of time it takes to travel this route, expressed in seconds (the value field) and as text. The textual representation is localized according to the query's language parameter.

See TextValueObject for more information.

ঐচ্ছিক TextValueObject

The length of time it takes to travel this route, based on current and historical traffic conditions. See the traffic_model request parameter for the options you can use to request that the returned value is optimistic, pessimistic, or a best-guess estimate. The duration is expressed in seconds (the value field) and as text. The textual representation is localized according to the query's language parameter. The duration in traffic is returned only if all of the following are true:

  • The request includes a departure_time parameter.
  • Traffic conditions are available for the requested route.
  • The mode parameter is set to driving.

See TextValueObject for more information.

ঐচ্ছিক ভাড়া

If present, contains the total fare (that is, the total ticket costs) on this route. This property is only returned for transit requests and only for transit providers where fare information is available.

See Fare for more information.

ভাড়া

The total fare for the route.

{
  "currency" : "USD",
  "value" : 6,
  "text" : "$6.00"
}
মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

An ISO 4217 currency code indicating the currency that the amount is expressed in.

প্রয়োজনীয় স্ট্রিং

The total fare amount, formatted in the requested language.

প্রয়োজনীয় সংখ্যা

The total fare amount, in the currency specified.

DistanceMatrixElementStatus

  • OK indicates the response contains a valid result.
  • NOT_FOUND indicates that the origin and/or destination of this pairing couldn't be geocoded.
  • ZERO_RESULTS indicates no route could be found between the origin and destination.
  • MAX_ROUTE_LENGTH_EXCEEDED indicates the requested route is too long and cannot be processed.

TextValueObject

An object containing a numeric value and its formatted text representation.

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

String value.

প্রয়োজনীয় সংখ্যা

Numeric value.

,
ইউরোপীয় অর্থনৈতিক অঞ্চল (EEA) ডেভেলপাররা

ভূমিকা

A Distance Matrix API (Legacy) request takes the following form:

https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters

where outputFormat may be either of the following values:

  • json (recommended) indicates output in JavaScript Object Notation (JSON).
  • xml indicates output as XML.

Certain parameters are required while others are optional. As is standard in URLs, all parameters are separated using the ampersand ( & ) character. All reserved characters (for example the plus sign "+") must be URL-encoded . The list of parameters and their possible values are enumerated below.

প্রয়োজনীয় প্যারামিটার

  • গন্তব্যস্থল

    One or more locations to use as the finishing point for calculating travel distance and time. The options for the destinations parameter are the same as for the origins parameter.

  • উৎপত্তি

    The starting point for calculating travel distance and time. You can supply one or more locations separated by the pipe character (|), in the form of a place ID, an address, or latitude/longitude coordinates:

    • Place ID : If you supply a place ID, you must prefix it with place_id: .
    • Address : If you pass an address, the service geocodes the string and converts it to a latitude/longitude coordinate to calculate distance. This coordinate may be different from that returned by the Geocoding API, for example a building entrance rather than its center.
      Note: using place IDs is preferred over using addresses or latitude/longitude coordinates. Using coordinates will always result in the point being snapped to the road nearest to those coordinates - which may not be an access point to the property, or even a road that will quickly or safely lead to the destination. Using the address will provide the distance to the center of the building, as opposed to an entrance to the building.
    • Coordinates : If you pass latitude/longitude coordinates, they they will snap to the nearest road. Passing a place ID is preferred. If you do pass coordinates, ensure that no space exists between the latitude and longitude values.
    • Plus codes must be formatted as a global code or a compound code. Format plus codes as shown here (plus signs are url-escaped to %2B and spaces are url-escaped to %20):
      • global code is a 4 character area code and 6 character or longer local code ( 849VCWC8+R9 is encoded to 849VCWC8%2BR9 ).
      • compound code is a 6 character or longer local code with an explicit location ( CWC8+R9 Mountain View, CA, USA is encoded to CWC8%2BR9%20Mountain%20View%20CA%20USA ).
    • Encoded Polyline Alternatively, you can supply an encoded set of coordinates using the Encoded Polyline Algorithm . This is particularly useful if you have a large number of origin points, because the URL is significantly shorter when using an encoded polyline.
      • Encoded polylines must be prefixed with enc: and followed by a colon : . For example: origins=enc:gfo}EtohhU:
      • You can also include multiple encoded polylines, separated by the pipe character | . For example:
        origins=enc:wc~oAwquwMdlTxiKtqLyiK:|enc:c~vnAamswMvlTor@tjGi}L:|enc:udymA{~bxM:
        

ঐচ্ছিক পরামিতি

  • আগমনের সময়

    Specifies the preferred time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time , but not both. Note that arrival_time must be specified as an integer.

  • এড়িয়ে চলুন

    Distances may be calculated that adhere to certain restrictions. Restrictions are indicated by use of the avoid parameter, and an argument to that parameter indicating the restriction to avoid. The following restrictions are supported:

    • tolls indicates that the calculated route should avoid toll roads/bridges.
    • highways indicates that the calculated route should avoid highways.
    • ferries indicates that the calculated route should avoid ferries.
    • indoor indicates that the calculated route should avoid indoor steps for walking and transit directions.

    It's possible to request a route that avoids any combination of tolls, highways and ferries by passing both restrictions to the avoid parameter. For example avoid=tolls|highways|ferries .

    Note: The addition of restrictions does not preclude routes that include the restricted feature; it biases the result to more favorable routes.
  • departure_time

    Specifies the preferred time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. If a departure_time later than 9999-12-31T23:59:59.999999999Z is specified, the API will fall back the departure_time to 9999-12-31T23:59:59.999999999Z. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second). The departure time may be specified in two cases:

    • For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time . If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
    • For requests where the travel mode is driving: You can specify the departure_time to receive a route and trip duration (response field: duration_in_traffic) that take traffic conditions into account. The departure_time must be set to the current time or some time in the future. It cannot be in the past.
    Note: If departure time is not specified, choice of route and duration are based on road network and average time-independent traffic conditions. Results for a given request may vary over time due to changes in the road network, updated average traffic conditions, and the distributed nature of the service. Results may also vary between nearly-equivalent routes at any time or frequency.
    Note: Distance Matrix requests specifying departure_time when mode=driving are limited to a maximum of 100 elements per request. The number of origins times the number of destinations defines the number of elements.
  • ভাষা

    যে ভাষায় ফলাফল ফেরত দেওয়া হয়।

    • সমর্থিত ভাষাগুলোর তালিকা দেখুন। গুগল প্রায়শই সমর্থিত ভাষাগুলো হালনাগাদ করে, তাই এই তালিকাটি সম্পূর্ণ নাও হতে পারে।
    • If language is not supplied, the API attempts to use the preferred language as specified in the Accept-Language header.
    • এপিআইটি ব্যবহারকারী এবং স্থানীয় বাসিন্দা উভয়ের জন্য পাঠযোগ্য একটি রাস্তার ঠিকানা প্রদান করার জন্য যথাসাধ্য চেষ্টা করে। সেই লক্ষ্য অর্জনের জন্য, এটি পছন্দের ভাষাটি অনুসরণ করে রাস্তার ঠিকানাগুলো স্থানীয় ভাষায় ফেরত দেয় এবং প্রয়োজনে ব্যবহারকারীর পাঠযোগ্য লিপিতে তা প্রতিবর্ণীকরণ করে। অন্য সব ঠিকানা পছন্দের ভাষাতেই ফেরত দেওয়া হয়। ঠিকানার সমস্ত উপাদান একই ভাষায় ফেরত দেওয়া হয়, যা প্রথম উপাদানটি থেকে বেছে নেওয়া হয়।
    • পছন্দের ভাষায় কোনো নাম উপলব্ধ না থাকলে, এপিআই সবচেয়ে কাছাকাছি মিল থাকা নামটি ব্যবহার করে।
    • The preferred language has a small influence on the set of results that the API chooses to return, and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another. For example, utca and tér are synonyms for street in Hungarian.
  • মোড

    For the calculation of distances and directions, you may specify the transportation mode to use. By default, DRIVING mode is used. By default, directions are calculated as driving directions. The following travel modes are supported:

    • driving (default) indicates standard driving directions or distance using the road network.
    • walking requests walking directions or distance using pedestrian paths & sidewalks (where available).
    • bicycling requests bicycling directions or distance using bicycle paths & preferred streets (where available).
    • transit requests directions or distance using public transit routes (where available). If you set the mode to transit, you can optionally specify either a departure_time or an arrival_time . If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference .
    Note: Both walking and bicycling directions may sometimes not include clear pedestrian or bicycling paths, so these directions will return warnings in the returned result which you must display to the user.
    Note: Transit trips are available for up to 7 days in the past or up to 100 days in the future, subject to availability of transit information supplied by data providers. Transit schedules change frequently, available transit trips may change over time and there is no guarantee to provide consistent results for predictions far in advance.
  • অঞ্চল

    The region code, specified as a ccTLD ("top-level domain") two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland").

  • traffic_model

    Specifies the assumptions to use when calculating time in traffic. This setting affects the value returned in the duration_in_traffic field in the response, which contains the predicted time in traffic based on historical averages. The traffic_model parameter may only be specified for driving directions where the request includes a departure_time . The available values for this parameter are:

    • best_guess (default) indicates that the returned duration_in_traffic should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic. Live traffic becomes more important the closer the departure_time is to now.
    • pessimistic indicates that the returned duration_in_traffic should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceed this value.
    • optimistic indicates that the returned duration_in_traffic should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value.

    The default value of best_guess will give the most useful predictions for the vast majority of use cases. It is possible the best_guess travel time prediction may be shorter than optimistic , or alternatively, longer than pessimistic , due to the way the best_guess prediction model integrates live traffic information.

  • transit_mode

    Specifies one or more preferred modes of transit. This parameter may only be specified for transit directions. The parameter supports the following arguments:

    • bus indicates that the calculated route should prefer travel by bus.
    • subway indicates that the calculated route should prefer travel by subway.
    • train indicates that the calculated route should prefer travel by train.
    • tram indicates that the calculated route should prefer travel by tram and light rail.
    • rail indicates that the calculated route should prefer travel by train, tram, light rail, and subway. This is equivalent to transit_mode=train|tram|subway .
  • transit_routing_preference

    Specifies preferences for transit routes. Using this parameter, you can bias the options returned, rather than accepting the default best route chosen by the API. This parameter may only be specified for transit directions. The parameter supports the following arguments:

    • less_walking indicates that the calculated route should prefer limited amounts of walking.
    • fewer_transfers indicates that the calculated route should prefer a limited number of transfers.
  • ইউনিট

    Specifies the unit system to use when displaying results.

    Note: this unit system setting only affects the text displayed within distance fields. The distance fields also contain values which are always expressed in meters.

Request examples

This example uses latitude/longitude coordinates to specify the destination coordinates:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=40.659569%2C-73.933783%7C40.729029%2C-73.851524%7C40.6860072%2C-73.6334271%7C40.598566%2C-73.7527626&key=YOUR_API_KEY'

This example uses plus codes to specify the destination coordinates:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco
  &origins=849VCWC8%2BR9
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=849VCWC8%2BR9&destinations=San%20Francisco&key=YOUR_API_KEY'

This example shows the same request using an encoded polyline:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A
  &origins=40.6655101%2C-73.89188969999998
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=40.6655101%2C-73.89188969999998&destinations=enc%3A_kjwFjtsbMt%60EgnKcqLcaOzkGari%40naPxhVg%7CJjjb%40cqLcaOzkGari%40naPxhV%3A&key=YOUR_API_KEY'

Traffic information

Traffic information is used when all the following apply (these are the conditions required to receive the duration_in_traffic field in the Distance Matrix response):

  • The travel mode parameter is driving , or is not specified ( driving is the default travel mode).
  • The request includes a valid departure_time parameter . The departure_time can be set to the current time or some time in the future. It cannot be in the past.

Optionally, you can include the traffic_model parameter in your request to specify the assumptions to use when calculating time in traffic.

The following URL initiates a Distance Matrix request for driving distances between Boston, MA or Charlestown, MA, and Lexington, MA and Concord, MA. The request includes a departure time, meeting all the requirements to return the duration_in_traffic field in the Distance Matrix response.

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?departure_time=now
  &destinations=Lexington%2CMA%7CConcord%2CMA
  &origins=Boston%2CMA%7CCharlestown%2CMA
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Boston%2CMA%7CCharlestown%2CMA&destinations=Lexington%2CMA%7CConcord%2CMA&departure_time=now&key=YOUR_API_KEY'

JSON

{
  "destination_addresses": ["Lexington, MA, USA", "Concord, MA, USA"],
  "origin_addresses": ["Boston, MA, USA", "Charlestown, Boston, MA, USA"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "33.3 km", "value": 33253 },
              "duration": { "text": "27 mins", "value": 1620 },
              "duration_in_traffic": { "text": "34 mins", "value": 2019 },
              "status": "OK",
            },
            {
              "distance": { "text": "41.5 km", "value": 41491 },
              "duration": { "text": "33 mins", "value": 1981 },
              "duration_in_traffic": { "text": "39 mins", "value": 2342 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "31.1 km", "value": 31100 },
              "duration": { "text": "26 mins", "value": 1543 },
              "duration_in_traffic": { "text": "29 mins", "value": 1754 },
              "status": "OK",
            },
            {
              "distance": { "text": "39.3 km", "value": 39338 },
              "duration": { "text": "32 mins", "value": 1904 },
              "duration_in_traffic": { "text": "35 mins", "value": 2077 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

XML


 OK
 Boston, MA, USA
 Charlestown, Boston, MA, USA
 Lexington, MA, USA
 Concord, MA, USA
 
  
   OK
   
    1620
    27 mins
   
   
    33253
    33.3 km
   
   
    2018
    34 mins
   
  
  
   OK
   
    1981
    33 mins
   
   
    41491
    41.5 km
   
   
    2342
    39 mins
   
  
 
 
  
   OK
   
    1543
    26 mins
   
   
    31100
    31.1 km
   
   
    1759
    29 mins
   
  
  
   OK
   
    1904
    32 mins
   
   
    39338
    39.3 km
   
   
    2077
    35 mins
   
  
 

Location Modifiers

You can use location modifiers to indicate how drivers should approach a particular location, by using the side_of_road modifier to specify which side of the road to use, or by specifying a heading to indicate the correct direction of travel.

Specify that calculated routes must pass through a particular side of the road

When specifying a location, you can request that the calculated route go through whichever side of the road the waypoint is biased towards by using the side_of_road: prefix. For example, this request will return the distance for a long route so that the vehicle ends on the side of the road to which the waypoint was biased:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3A37.7663444%2C-122.4412006
  &origins=37.7680296%2C-122.4375126
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=37.7680296%2C-122.4375126&destinations=side_of_road%3A37.7663444%2C-122.4412006&key=YOUR_API_KEY'

When using side_of_road: with encoded polylines, the modifier is applied to every location along the polyline. For example, the two destinations in this request both use the parameter:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A
  &origins=San%20Francisco%20City%20hall
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=San%20Francisco%20City%20hall&destinations=side_of_road%3Aenc%3A%7BoqeF%60fejV%5BnC%3A&key=YOUR_API_KEY'

The side_of_road: modifier may only be used with this restriction:

  • The travel mode parameter is driving , or is not specified ( driving is the default travel mode).

Specify that calculated routes should have a particular heading

When specifying a location, you can request that the calculated route go through the location in a particular heading. This heading is specified with the prefix heading=X: , where X is an integer degree value between 0 (inclusive) and 360 (exclusive). A heading of 0 indicates North, 90 indicates East, continuing clockwise. For example, in this request the calculated route goes east from the origin, then takes a U-turn:

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=37.773245%2C-122.469502
  &origins=heading%3D90%3A37.773279%2C-122.468780
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=heading%3D90%3A37.773279%2C-122.468780&destinations=37.773245%2C-122.469502&key=YOUR_API_KEY'

The heading=X: modifier may only be used with these restrictions:

  • The travel mode parameter is driving , bicycling , or is not specified ( driving is the default travel mode).
  • The side_of_road modifier is not specified for the same location.
  • The location is specified with a latitude/longitude value. You may not use heading with addresses, Place IDs, or encoded polylines.

Distance Matrix request and responses

A sample HTTP request is shown below, requesting distance and duration from Vancouver, BC, Canada and from Seattle, WA, USA, to San Francisco, CA, USA and to Victoria, BC, Canada.

ইউআরএল

https://maps.googleapis.com/maps/api/distancematrix/json
  ?destinations=San%20Francisco%7CVictoria%20BC
  &language=fr-FR
  &mode=bicycling
  &origins=Vancouver%20BC%7CSeattle
  &key=YOUR_API_KEY

কার্ল

curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver%20BC%7CSeattle&destinations=San%20Francisco%7CVictoria%20BC&mode=bicycling&language=fr-FR&key=YOUR_API_KEY'

This request will return four elements - two origins times two destinations:

Vancouver to San Francisco Vancouver to Victoria
Seattle to San Francisco Seattle to Victoria

Results are returned in rows, each row containing one origin paired with each destination.

JSON

{
  "destination_addresses":
    ["San Francisco, Californie, États-Unis", "Victoria, BC, Canada"],
  "origin_addresses":
    ["Vancouver, BC, Canada", "Seattle, Washington, États-Unis"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "1 712 km", "value": 1711765 },
              "duration": { "text": "3 jours 16 heures", "value": 318119 },
              "status": "OK",
            },
            {
              "distance": { "text": "140 km", "value": 139695 },
              "duration": { "text": "6 heures 49 minutes", "value": 24567 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "1 452 km", "value": 1451704 },
              "duration": { "text": "3 jours 2 heures", "value": 266680 },
              "status": "OK",
            },
            {
              "distance": { "text": "146 km", "value": 146500 },
              "duration": { "text": "2 heures 53 minutes", "value": 10374 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}

XML


 OK
 Vancouver, BC, Canada
 Seattle, Washington, États-Unis
 San Francisco, Californie, États-Unis
 Victoria, BC, Canada
 
  
   OK
   
    318119
    3 jours 16 heures
   
   
    1711765
    1712 km
   
  
  
   OK
   
    24567
    6 heures 49 minutes
   
   
    139695
    140 km
   
  
 
 
  
   OK
   
    266680
    3 jours 2 heures
   
   
    1451704
    1452 km
   
  
  
   OK
   
    10374
    2 heures 53 minutes
   
   
    146500
    146 km
   
  
 

DistanceMatrixResponse

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় Array<string>

An array of addresses as returned by the API from your original request. As with origin_addresses , these are localized if appropriate. This content is meant to be read as-is. Don't programmatically parse the formatted addresses.

প্রয়োজনীয় Array<string>

An array of addresses as returned by the API from your original request. These are formatted by the geocoder and localized according to the language parameter passed with the request. This content is meant to be read as-is. Don't programmatically parse the formatted addresses.

প্রয়োজনীয় Array< DistanceMatrixRow >

An array of elements, which in turn each contain a status , duration , and distance element.

See DistanceMatrixRow for more information.

প্রয়োজনীয় DistanceMatrixStatus

Contains the status of the request, and may contain debugging information to help you track down why the request failed.

See DistanceMatrixStatus for more information.

ঐচ্ছিক স্ট্রিং

A string containing the human-readable text of any errors encountered while the request was being processed.

DistanceMatrixStatus

Status codes returned by service.

  • OK indicates the response contains a valid result.
  • INVALID_REQUEST indicates that the provided request was invalid.
  • MAX_ELEMENTS_EXCEEDED indicates that the product of origins and destinations exceeds the per-query limit.
  • MAX_DIMENSIONS_EXCEEDED indicates that the number of origins or destinations exceeds the per-query limit.
  • OVER_DAILY_LIMIT indicates any of the following:
    • The API key is missing or invalid.
    • Billing has not been enabled on your account.
    • A self-imposed usage cap has been exceeded.
    • The provided method of payment is no longer valid (for example, a credit card has expired).
  • OVER_QUERY_LIMIT indicates the service has received too many requests from your application within the allowed time period.
  • REQUEST_DENIED indicates that the service denied use of the Distance Matrix service by your application.
  • UNKNOWN_ERROR indicates a Distance Matrix request couldn't be processed due to a server error. The request may succeed if you try again.

DistanceMatrixRow

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় Array< DistanceMatrixElement >

When the Distance Matrix API returns results, it places them within a JSON rows array. Even if no results are returned (such as when the origins and/or destinations don't exist), it still returns an empty array.

Rows are ordered according to the values in the origin parameter of the request. Each row corresponds to an origin, and each element within that row corresponds to a pairing of the origin with a destination value.

Each row array contains one or more element entries, which in turn contain the information about a single origin-destination pairing.

See DistanceMatrixElement for more information.

DistanceMatrixElement

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় DistanceMatrixElementStatus

A status for the element.

See DistanceMatrixElementStatus for more information.

ঐচ্ছিক TextValueObject

The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the unit parameter of the original request, or the origin's region.

See TextValueObject for more information.

ঐচ্ছিক TextValueObject

The length of time it takes to travel this route, expressed in seconds (the value field) and as text. The textual representation is localized according to the query's language parameter.

See TextValueObject for more information.

ঐচ্ছিক TextValueObject

The length of time it takes to travel this route, based on current and historical traffic conditions. See the traffic_model request parameter for the options you can use to request that the returned value is optimistic, pessimistic, or a best-guess estimate. The duration is expressed in seconds (the value field) and as text. The textual representation is localized according to the query's language parameter. The duration in traffic is returned only if all of the following are true:

  • The request includes a departure_time parameter.
  • Traffic conditions are available for the requested route.
  • The mode parameter is set to driving.

See TextValueObject for more information.

ঐচ্ছিক ভাড়া

If present, contains the total fare (that is, the total ticket costs) on this route. This property is only returned for transit requests and only for transit providers where fare information is available.

See Fare for more information.

ভাড়া

The total fare for the route.

{
  "currency" : "USD",
  "value" : 6,
  "text" : "$6.00"
}
মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

An ISO 4217 currency code indicating the currency that the amount is expressed in.

প্রয়োজনীয় স্ট্রিং

The total fare amount, formatted in the requested language.

প্রয়োজনীয় সংখ্যা

The total fare amount, in the currency specified.

DistanceMatrixElementStatus

  • OK indicates the response contains a valid result.
  • NOT_FOUND indicates that the origin and/or destination of this pairing couldn't be geocoded.
  • ZERO_RESULTS indicates no route could be found between the origin and destination.
  • MAX_ROUTE_LENGTH_EXCEEDED indicates the requested route is too long and cannot be processed.

TextValueObject

An object containing a numeric value and its formatted text representation.

মাঠ প্রয়োজনীয় প্রকার বর্ণনা
প্রয়োজনীয় স্ট্রিং

String value.

প্রয়োজনীয় সংখ্যা

Numeric value.