এর মাধ্যমে বিভিন্ন স্থানের মধ্যে যাতায়াতের দিকনির্দেশনা পাওয়া যায়।
নীচের উদাহরণটি দেখায় কিভাবে আপনি এই ক্লাসটি ব্যবহার করে প্রথমে লিঙ্কন সেন্টারে থেমে টাইমস স্কোয়ার থেকে সেন্ট্রাল পার্ক যাওয়ার দিকনির্দেশনা পেতে পারেন, একটি মানচিত্রে অবস্থান এবং পথটি চিহ্নিত করতে পারেন এবং মানচিত্রটি একটি ইমেইলে পাঠাতে পারেন।
// Get the directions. const directions = Maps.newDirectionFinder() .setOrigin('Times Square, New York, NY') .addWaypoint('Lincoln Center, New York, NY') .setDestination('Central Park, New York, NY') .setMode(Maps.DirectionFinder.Mode.DRIVING) .getDirections(); const route = directions.routes[0]; // Set up marker styles. let markerLetterCode = 'A'.charCodeAt(); // Add markers to the map. const map = Maps.newStaticMap(); for (let i = 0; i < route.legs.length; i++) { const leg = route.legs[i]; if (i === 0) { // Add a marker for the start location of the first leg only. map.setMarkerStyle( Maps.StaticMap.MarkerSize.MID, Maps.StaticMap.Color.GREEN, String.fromCharCode(markerLetterCode), ); map.addMarker(leg.start_location.lat, leg.start_location.lng); markerLetterCode++; } map.setMarkerStyle( Maps.StaticMap.MarkerSize.MID, Maps.StaticMap.Color.GREEN, String.fromCharCode(markerLetterCode), ); map.addMarker(leg.end_location.lat, leg.end_location.lng); markerLetterCode++; } // Add a path for the entire route. map.addPath(route.overview_polyline.points); // Send the map in an email. const toAddress = Session.getActiveUser().getEmail(); MailApp.sendEmail( toAddress, 'Directions', `Please open: ${map.getMapUrl()}&key=YOUR_API_KEY`, { htmlBody: 'See below.<br/><img src="cid:mapImage">', inlineImages: { mapImage: Utilities.newBlob(map.getMapImage(), 'image/png'), }, }, );
আরও দেখুন
পদ্ধতি
| পদ্ধতি | রিটার্ন টাইপ | সংক্ষিপ্ত বিবরণ |
|---|---|---|
add Waypoint(latitude, longitude) | Direction Finder | একটি পয়েন্ট (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে এমন একটি ওয়েপয়েন্ট যোগ করে, যার মধ্য দিয়ে রুটটিকে অবশ্যই যেতে হবে। |
add Waypoint(address) | Direction Finder | একটি ঠিকানা ব্যবহার করে এমন একটি ওয়েপয়েন্ট যোগ করে, যার মধ্য দিয়ে রুটটিকে অবশ্যই যেতে হবে। |
clear Waypoints() | Direction Finder | বর্তমান ওয়েপয়েন্ট সেটটি মুছে দেয়। |
get Directions() | Object | নির্ধারিত উৎস, গন্তব্য এবং অন্যান্য বিকল্পগুলো ব্যবহার করে দিকনির্দেশনা পাওয়া যায়। |
set Alternatives(useAlternatives) | Direction Finder | শুধুমাত্র সর্বোচ্চ র্যাঙ্কের রুটের পরিবর্তে বিকল্প রুটগুলো ফেরত দেওয়া হবে কিনা তা নির্ধারণ করে (ডিফল্ট মান false )। |
set Arrive(time) | Direction Finder | পৌঁছানোর কাঙ্ক্ষিত সময় নির্ধারণ করে (প্রযোজ্য ক্ষেত্রে)। |
set Avoid(avoid) | Direction Finder | নির্দিষ্ট ধরণের বিধিনিষেধ এড়ানো হবে কিনা তা নির্ধারণ করে। |
set Depart(time) | Direction Finder | প্রস্থানের কাঙ্ক্ষিত সময় নির্ধারণ করে (প্রযোজ্য ক্ষেত্রে)। |
set Destination(latitude, longitude) | Direction Finder | একটি বিন্দু (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে, দিকনির্দেশ গণনা করার জন্য শেষ অবস্থান নির্ধারণ করে। |
set Destination(address) | Direction Finder | একটি ঠিকানা ব্যবহার করে, দিকনির্দেশনা গণনা করার জন্য শেষ গন্তব্যস্থল নির্ধারণ করে। |
set Language(language) | Direction Finder | দিকনির্দেশনার জন্য ব্যবহৃত ভাষা নির্ধারণ করে। |
set Mode(mode) | Direction Finder | ভ্রমণের ধরণ নির্ধারণ করে (ডিফল্টরূপে গাড়ি চালানো)। |
set Optimize Waypoints(optimizeOrder) | Direction Finder | ওয়েপয়েন্টগুলোকে আরও কার্যকর ক্রমে পুনর্বিন্যাস করে প্রদত্ত রুটটি অপ্টিমাইজ করা হবে কি না, তা নির্ধারণ করে (ডিফল্ট মান false )। |
set Origin(latitude, longitude) | Direction Finder | একটি বিন্দু (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে দিক নির্ণয়ের জন্য প্রারম্ভিক অবস্থান নির্ধারণ করে। |
set Origin(address) | Direction Finder | একটি ঠিকানা ব্যবহার করে দিক নির্ণয়ের জন্য শুরুর স্থান নির্ধারণ করে। |
set Region(region) | Direction Finder | অবস্থানের নাম ব্যাখ্যা করার জন্য একটি অঞ্চল নির্ধারণ করে। |
বিস্তারিত ডকুমেন্টেশন
addWaypoint(latitude, longitude)
একটি পয়েন্ট (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে এমন একটি ওয়েপয়েন্ট যোগ করে, যার মধ্য দিয়ে রুটটিকে অবশ্যই যেতে হবে।
// Creates a DirectionFinder with a wapoint at Lincoln Center. const directionFinder = Maps.newDirectionFinder().addWaypoint( 40.772628, -73.984243, );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
latitude | Number | ওয়েপয়েন্টের অক্ষাংশ। |
longitude | Number | ওয়েপয়েন্টের দ্রাঘিমাংশ। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
addWaypoint(address)
একটি ঠিকানা ব্যবহার করে এমন একটি ওয়েপয়েন্ট যোগ করে, যার মধ্য দিয়ে রুটটিকে অবশ্যই যেতে হবে।
// Creates a DirectionFinder with a wapoint at Lincoln Center. const directionFinder = Maps.newDirectionFinder().addWaypoint( 'Lincoln Center, New York, NY', );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
address | String | একটি ঠিকানা। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
clearWaypoints()
বর্তমান ওয়েপয়েন্ট সেটটি মুছে দেয়।
const directionFinder = Maps.newDirectionFinder(); // ... // Do something interesting here ... // ... // Remove all waypoints added with addWaypoint(). directionFinder.clearWaypoints();
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
getDirections()
নির্ধারিত উৎস, গন্তব্য এবং অন্যান্য বিকল্পগুলো ব্যবহার করে দিকনির্দেশনা পাওয়া যায়।
// Logs how long it takes to walk from Times Square to Central Park. const directions = Maps.newDirectionFinder() .setOrigin('Times Square, New York, NY') .setDestination('Central Park, New York, NY') .setMode(Maps.DirectionFinder.Mode.WALKING) .getDirections(); Logger.log(directions.routes[0].legs[0].duration.text);
ফেরত
Object — একটি JSON অবজেক্ট, যাতে এখানে বর্ণিত দিকনির্দেশনাগুলোর জন্য রুটের সেট রয়েছে।
আরও দেখুন
setAlternatives(useAlternatives)
শুধুমাত্র সর্বোচ্চ র্যাঙ্কের রুটের পরিবর্তে বিকল্প রুটগুলো ফেরত দেওয়া হবে কি না, তা নির্ধারণ করে (ডিফল্ট মান false )। যদি true , তাহলে ফলাফলস্বরূপ প্রাপ্ত অবজেক্টের routes অ্যারেতে একাধিক এন্ট্রি থাকতে পারে।
// Creates a DirectionFinder with alternative routes enabled. const directionFinder = Maps.newDirectionFinder().setAlternatives(true);
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
use Alternatives | Boolean | বিকল্প পথ ফেরত দিতে true , অন্যথায় false । |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
setArrive(time)
পৌঁছানোর কাঙ্ক্ষিত সময় নির্ধারণ করে (প্রযোজ্য ক্ষেত্রে)।
// Creates a DirectionFinder with an arrival time of 2 hours from now. const now = new Date(); const arrive = new Date(now.getTime() + 2 * 60 * 60 * 1000); const directionFinder = Maps.newDirectionFinder().setArrive(arrive);
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
time | Date | আগমনের সময়। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setAvoid(avoid)
নির্দিষ্ট ধরণের বিধিনিষেধ এড়ানো হবে কিনা তা নির্ধারণ করে।
// Creates a DirectionFinder that avoid highways. const directionFinder = Maps.newDirectionFinder().setAvoid( Maps.DirectionFinder.Avoid.HIGHWAYS, );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
avoid | String | Avoid থেকে একটি ধ্রুবক মান। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setDepart(time)
প্রস্থানের কাঙ্ক্ষিত সময় নির্ধারণ করে (প্রযোজ্য ক্ষেত্রে)।
// Creates a DirectionFinder with a departure time of 1 hour from now. const now = new Date(); const depart = new Date(now.getTime() + 1 * 60 * 60 * 1000); const directionFinder = Maps.newDirectionFinder().setDepart(depart);
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
time | Date | প্রস্থানের সময়। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setDestination(latitude, longitude)
একটি বিন্দু (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে, দিকনির্দেশ গণনা করার জন্য শেষ অবস্থান নির্ধারণ করে।
// Creates a DirectionFinder with the destination set to Central Park. const directionFinder = Maps.newDirectionFinder().setDestination( 40.777052, -73.975464, );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
latitude | Number | শেষ অবস্থানের অক্ষাংশ। |
longitude | Number | শেষ অবস্থানের দ্রাঘিমাংশ। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
setDestination(address)
একটি ঠিকানা ব্যবহার করে, দিকনির্দেশনা গণনা করার জন্য শেষ গন্তব্যস্থল নির্ধারণ করে।
// Creates a DirectionFinder with the destination set to Central Park. const directionFinder = Maps.newDirectionFinder().setDestination( 'Central Park, New York, NY', );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
address | String | শেষ ঠিকানা। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
setLanguage(language)
দিকনির্দেশনার জন্য ব্যবহৃত ভাষা নির্ধারণ করে।
// Creates a DirectionFinder with the language set to French. const directionFinder = Maps.newDirectionFinder().setLanguage('fr');
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
language | String | একটি BCP-47 ভাষা শনাক্তকারী। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setMode(mode)
ভ্রমণের ধরণ নির্ধারণ করে (ডিফল্টরূপে গাড়ি চালানো)।
// Creates a DirectionFinder with the mode set to walking. const directionFinder = Maps.newDirectionFinder().setMode( Maps.DirectionFinder.Mode.WALKING, );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
mode | String | Mode থেকে একটি ধ্রুবক মান। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setOptimizeWaypoints(optimizeOrder)
ওয়েপয়েন্টগুলোকে আরও কার্যকর ক্রমে পুনর্বিন্যাস করে প্রদত্ত রুটটি অপ্টিমাইজ করা হবে কি না, তা নির্ধারণ করে (ডিফল্ট মান false )।
// Creates a DirectionFinder with wapoint optimization enabled. const directionFinder = Maps.newDirectionFinder().setOptimizeWaypoints(true);
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
optimize Order | Boolean | ক্রম অপ্টিমাইজ করতে true , অন্যথায় false । |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
আরও দেখুন
setOrigin(latitude, longitude)
একটি বিন্দু (অক্ষাংশ/দ্রাঘিমাংশ) ব্যবহার করে দিক নির্ণয়ের জন্য প্রারম্ভিক অবস্থান নির্ধারণ করে।
// Creates a DirectionFinder with the origin set to Times Square. const directionFinder = Maps.newDirectionFinder().setOrigin( 40.759011, -73.984472, );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
latitude | Number | প্রারম্ভিক স্থানের অক্ষাংশ। |
longitude | Number | প্রারম্ভিক স্থানের দ্রাঘিমাংশ। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।
setOrigin(address)
একটি ঠিকানা ব্যবহার করে দিক নির্ণয়ের জন্য শুরুর স্থান নির্ধারণ করে।
// Creates a DirectionFinder with the origin set to Times Square. const directionFinder = Maps.newDirectionFinder().setOrigin( 'Times Square, New York, NY', );
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
address | String | প্রারম্ভিক ঠিকানা। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder ইনস্ট্যান্স।
setRegion(region)
অবস্থানের নাম ব্যাখ্যা করার জন্য একটি অঞ্চল নির্ধারণ করে। সমর্থিত অঞ্চল কোডগুলো গুগল ম্যাপস দ্বারা সমর্থিত ccTLD-গুলোর সাথে সঙ্গতিপূর্ণ। উদাহরণস্বরূপ, "uk" অঞ্চল কোডটি "maps.google.co.uk"-এর সাথে সঙ্গতিপূর্ণ।
// Creates a DirectionFinder with the region set to France. const directionFinder = Maps.newDirectionFinder().setRegion('fr');
প্যারামিটার
| নাম | প্রকার | বর্ণনা |
|---|---|---|
region | String | ব্যবহার করার জন্য অঞ্চল কোড। |
ফেরত
DirectionFinder — কলগুলোর শৃঙ্খল সহজ করার জন্য DirectionFinder অবজেক্ট।