রুট হলো একটি শুরু বা উৎসস্থল এবং শেষ বা গন্তব্যস্থলের মধ্যবর্তী একটি চলাচলযোগ্য পথ। আপনি হাঁটা, সাইকেল চালানো বা বিভিন্ন ধরনের যানবাহনের মতো বিভিন্ন পরিবহন মাধ্যমের জন্য রুট বেছে নিতে পারেন। এছাড়াও আপনি রুটের বিবরণ, যেমন দূরত্ব, রুটটি অতিক্রম করার আনুমানিক সময়, প্রত্যাশিত টোল এবং রুটটি অতিক্রম করার জন্য ধাপে ধাপে নির্দেশাবলীর জন্য অনুরোধ করতে পারেন।
সম্পূর্ণ উদাহরণ সোর্স কোড দেখুন
নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে দুটি অবস্থানের মধ্যে গাড়ি চালানোর দিকনির্দেশনার জন্য একটি রুট পাওয়া যায়।
টাইপস্ক্রিপ্ট
// Initialize and add the map. let map: google.maps.Map; let mapPolylines: google.maps.Polyline[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA // Initialize and add the map. async function init(): Promise<void> { // Request the needed libraries. const [{ Map }, { Place }, { Route }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), google.maps.importLibrary('routes'), ]); map = new Map(document.getElementById('map')!, { zoom: 12, center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); // Use address strings in a directions request. const requestWithAddressStrings = { origin: '1600 Amphitheatre Parkway, Mountain View, CA', destination: '345 Spear Street, San Francisco, CA', fields: ['path'], }; console.log({ requestWithAddressStrings }); // Use Place IDs in a directions request. const originPlaceInstance = new Place({ id: 'ChIJiQHsW0m3j4ARm69rRkrUF3w', // Mountain View, CA }); const destinationPlaceInstance = new Place({ id: 'ChIJIQBpAG2ahYAR_6128GcTUEo', // San Francisco, CA }); const requestWithPlaceIds: google.maps.routes.ComputeRoutesRequest = { origin: originPlaceInstance, destination: destinationPlaceInstance, fields: ['path'], // Request fields needed to draw polylines. }; console.log({ requestWithPlaceIds }); // Use lat/lng in a directions request. // Mountain View, CA const originLatLng = { lat: 37.422, lng: -122.084058 }; // San Francisco, CA const destinationLatLng = { lat: 37.774929, lng: -122.419415 }; // Define a computeRoutes request. const requestWithLatLngs: google.maps.routes.ComputeRoutesRequest = { origin: originLatLng, destination: destinationLatLng, fields: ['path'], }; console.log({ requestWithLatLngs }); // Use Plus Codes in a directions request. const requestWithPlusCodes: google.maps.routes.ComputeRoutesRequest = { origin: '849VCWC8+R9', // Mountain View, CA destination: 'CRHJ+C3 Stanford, CA 94305, USA', // Stanford, CA fields: ['path'], }; console.log({ requestWithPlusCodes }); // Define a routes request. const request: google.maps.routes.ComputeRoutesRequest = { origin: 'Mountain View, CA', destination: 'San Francisco, CA', travelMode: 'DRIVING', fields: ['path'], // Request fields needed to draw polylines. }; // Call computeRoutes to get the directions. const { routes } = await Route.computeRoutes(request); // Use createPolylines to create polylines for the route. if (!routes) { console.warn('No routes found.'); return; } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. mapPolylines.forEach((polyline) => { polyline.setMap(map); }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); // Add markers to the map markers.forEach((marker) => { marker.map = map; }); // Display the raw JSON for the result in the console. console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`); // Fit the map to the path. void fitMapToPath(routes[0].path!); } // Helper function to fit the map to the path. async function fitMapToPath(path: google.maps.LatLngLiteral[]) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { bounds.extend(point); }); map.fitBounds(bounds); } void init();
জাভাস্ক্রিপ্ট
// Initialize and add the map. let map; let mapPolylines = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA // Initialize and add the map. async function init() { // Request the needed libraries. const [{ Map }, { Place }, { Route }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), google.maps.importLibrary('routes'), ]); map = new Map(document.getElementById('map'), { zoom: 12, center, mapTypeControl: false, mapId: 'DEMO_MAP_ID', }); // Use address strings in a directions request. const requestWithAddressStrings = { origin: '1600 Amphitheatre Parkway, Mountain View, CA', destination: '345 Spear Street, San Francisco, CA', fields: ['path'], }; console.log({ requestWithAddressStrings }); // Use Place IDs in a directions request. const originPlaceInstance = new Place({ id: 'ChIJiQHsW0m3j4ARm69rRkrUF3w', // Mountain View, CA }); const destinationPlaceInstance = new Place({ id: 'ChIJIQBpAG2ahYAR_6128GcTUEo', // San Francisco, CA }); const requestWithPlaceIds = { origin: originPlaceInstance, destination: destinationPlaceInstance, fields: ['path'], // Request fields needed to draw polylines. }; console.log({ requestWithPlaceIds }); // Use lat/lng in a directions request. // Mountain View, CA const originLatLng = { lat: 37.422, lng: -122.084058 }; // San Francisco, CA const destinationLatLng = { lat: 37.774929, lng: -122.419415 }; // Define a computeRoutes request. const requestWithLatLngs = { origin: originLatLng, destination: destinationLatLng, fields: ['path'], }; console.log({ requestWithLatLngs }); // Use Plus Codes in a directions request. const requestWithPlusCodes = { origin: '849VCWC8+R9', // Mountain View, CA destination: 'CRHJ+C3 Stanford, CA 94305, USA', // Stanford, CA fields: ['path'], }; console.log({ requestWithPlusCodes }); // Define a routes request. const request = { origin: 'Mountain View, CA', destination: 'San Francisco, CA', travelMode: 'DRIVING', fields: ['path'], // Request fields needed to draw polylines. }; // Call computeRoutes to get the directions. const { routes } = await Route.computeRoutes(request); // Use createPolylines to create polylines for the route. if (!routes) { console.warn('No routes found.'); return; } mapPolylines = routes[0].createPolylines(); // Add polylines to the map. mapPolylines.forEach((polyline) => { polyline.setMap(map); }); // Create markers to start and end points. const markers = await routes[0].createWaypointAdvancedMarkers(); // Add markers to the map markers.forEach((marker) => { marker.map = map; }); // Display the raw JSON for the result in the console. console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`); // Fit the map to the path. void fitMapToPath(routes[0].path); } // Helper function to fit the map to the path. async function fitMapToPath(path) { const { LatLngBounds } = await google.maps.importLibrary('core'); const bounds = new LatLngBounds(); path.forEach((point) => { bounds.extend(point); }); map.fitBounds(bounds); } void init();
সিএসএস
/* * Always set the map height explicitly to define the size of the div element * that contains the map. */ #map { height: 100%; } /* * Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; }
এইচটিএমএল
<html>
<head>
<title>Get directions</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<script>
// prettier-ignore
(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
key: "GOOGLE_MAPS_API_KEY"
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html> দুটি অবস্থানের মধ্যে একটি রুটের অনুরোধ করতে computeRoutes() মেথডটি কল করুন। নিচের উদাহরণটিতে একটি অনুরোধ সংজ্ঞায়িত করা এবং তারপর একটি রুট পাওয়ার জন্য computeRoutes() কল করার পদ্ধতি দেখানো হয়েছে।
// Import the Routes library. const { Route } = await google.maps.importLibrary('routes'); // Define a computeRoutes request. const request = { origin: 'Mountain View, CA', destination: 'San Francisco, CA', }; // Call the computeRoutes() method to get routes. const {routes} = await Route.computeRoutes(request);
ফেরত দেওয়ার জন্য ক্ষেত্রগুলি নির্বাচন করুন
যখন আপনি কোনো রাউটের জন্য অনুরোধ করেন, তখন রেসপন্সে কী তথ্য ফেরত আসবে তা নির্দিষ্ট করার জন্য আপনাকে অবশ্যই একটি ফিল্ড মাস্ক ব্যবহার করতে হবে। আপনি ফিল্ড মাস্কে Route ক্লাস প্রপার্টিগুলোর নাম উল্লেখ করতে পারেন।
ফিল্ড মাস্ক ব্যবহার করলে এটিও নিশ্চিত হয় যে আপনি অপ্রয়োজনীয় ডেটার জন্য অনুরোধ করছেন না, যা ফলস্বরূপ প্রতিক্রিয়ার বিলম্ব কমাতে সাহায্য করে এবং আপনার সিস্টেমের প্রয়োজন নেই এমন তথ্য ফেরত দেওয়া এড়িয়ে চলে।
নিম্নলিখিত কোড স্নিপেটে দেখানো অনুযায়ী, ComputeRoutesRequest.fields প্রপার্টি সেট করে আপনার প্রয়োজনীয় ফিল্ডগুলির তালিকা নির্দিষ্ট করুন:
টাইপস্ক্রিপ্ট
// Define a routes request. const request: google.maps.routes.ComputeRoutesRequest = { origin: 'Mountain View, CA', destination: 'San Francisco, CA', travelMode: 'DRIVING', fields: ['path'], // Request fields needed to draw polylines. };
জাভাস্ক্রিপ্ট
// Define a routes request. const request = { origin: 'Mountain View, CA', destination: 'San Francisco, CA', travelMode: 'DRIVING', fields: ['path'], // Request fields needed to draw polylines. };
একটি রুটের জন্য অবস্থানগুলি নির্দিষ্ট করুন।
একটি রুট গণনা করার জন্য, আপনাকে ন্যূনতমভাবে রুটের উৎস ও গন্তব্যস্থলের অবস্থান এবং একটি ফিল্ড মাস্ক নির্দিষ্ট করতে হবে। এছাড়াও আপনি একটি রুট বরাবর মধ্যবর্তী ওয়েপয়েন্ট নির্দিষ্ট করতে পারেন এবং ওয়েপয়েন্ট ব্যবহার করে রুটে স্টপ বা পাসথ্রু পয়েন্ট যোগ করার মতো অন্যান্য কাজও করতে পারেন।
ComputeRoutesRequest এ, আপনি নিম্নলিখিত যেকোনো উপায়ে একটি অবস্থান নির্দিষ্ট করতে পারেন:
- স্থান (পছন্দের)
- অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক
- ঠিকানা স্ট্রিং ("শিকাগো, আইএল" অথবা "ডারউইন, এনটি, অস্ট্রেলিয়া")
- প্লাস কোড
আপনি একটি অনুরোধের সমস্ত ওয়েপয়েন্টের অবস্থান একই উপায়ে নির্দিষ্ট করতে পারেন, অথবা সেগুলোকে মিশ্রিতও করতে পারেন। উদাহরণস্বরূপ, আপনি উৎস ওয়েপয়েন্টের জন্য অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক এবং গন্তব্য ওয়েপয়েন্টের জন্য একটি প্লেস অবজেক্ট ব্যবহার করতে পারেন।
দক্ষতা ও নির্ভুলতার জন্য, অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক বা ঠিকানা স্ট্রিং-এর পরিবর্তে প্লেস অবজেক্ট ব্যবহার করুন। প্লেস আইডিগুলো অনন্যভাবে সুনির্দিষ্ট এবং রাউটিং-এর জন্য জিওকোডিং সুবিধা প্রদান করে, যেমন অ্যাক্সেস পয়েন্ট ও ট্র্যাফিক ভেরিয়েবল। অবস্থান নির্দিষ্ট করার অন্যান্য পদ্ধতির ফলে যে পরিস্থিতিগুলো তৈরি হতে পারে, সেগুলো এড়াতে এগুলো সাহায্য করে:
- অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করলে অবস্থানটি সেই স্থানাঙ্কের সবচেয়ে কাছের রাস্তায় স্থির হয়ে যেতে পারে - যা হয়তো সম্পত্তিতে প্রবেশের পথ নয়, এমনকি এমন কোনো রাস্তাও নয় যা দ্রুত বা নিরাপদে গন্তব্যে নিয়ে যায়।
- একটি রুট গণনা করার আগে, ঠিকানা স্ট্রিংগুলিকে অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্কে রূপান্তর করার জন্য Routes API দ্বারা প্রথমে জিওকোড করতে হয়। এই রূপান্তরটি পারফরম্যান্সকে প্রভাবিত করতে পারে।
অবস্থানটিকে একটি Place অবজেক্ট হিসেবে নির্দিষ্ট করুন (পছন্দনীয়)
Place ব্যবহার করে কোনো অবস্থান নির্দিষ্ট করতে, একটি নতুন Place ইনস্ট্যান্স তৈরি করুন। নিম্নলিখিত কোড স্নিপেটটিতে origin এবং destination জন্য নতুন Place ইনস্ট্যান্স তৈরি করা এবং তারপর সেগুলোকে একটি ComputeRoutesRequest এ ব্যবহার করার পদ্ধতি দেখানো হয়েছে:
টাইপস্ক্রিপ্ট
// Use Place IDs in a directions request. const originPlaceInstance = new Place({ id: 'ChIJiQHsW0m3j4ARm69rRkrUF3w', // Mountain View, CA }); const destinationPlaceInstance = new Place({ id: 'ChIJIQBpAG2ahYAR_6128GcTUEo', // San Francisco, CA }); const requestWithPlaceIds: google.maps.routes.ComputeRoutesRequest = { origin: originPlaceInstance, destination: destinationPlaceInstance, fields: ['path'], // Request fields needed to draw polylines. };
জাভাস্ক্রিপ্ট
// Use Place IDs in a directions request. const originPlaceInstance = new Place({ id: 'ChIJiQHsW0m3j4ARm69rRkrUF3w', // Mountain View, CA }); const destinationPlaceInstance = new Place({ id: 'ChIJIQBpAG2ahYAR_6128GcTUEo', // San Francisco, CA }); const requestWithPlaceIds = { origin: originPlaceInstance, destination: destinationPlaceInstance, fields: ['path'], // Request fields needed to draw polylines. };
অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক
অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক হিসাবে একটি অবস্থান নির্দিষ্ট করতে, একটি নতুন google.maps.LatLngLiteral , google.maps.LatLngAltitude , অথবা google.maps.LatLngAltitudeLiteral ইনস্ট্যান্স তৈরি করুন। নিম্নলিখিত কোড স্নিপেটটি origin এবং destination জন্য নতুন google.maps.LatLngLiteral ইনস্ট্যান্স তৈরি করা এবং তারপর computeRoutesRequest এ সেগুলি ব্যবহার করা দেখাচ্ছে:
টাইপস্ক্রিপ্ট
// Use lat/lng in a directions request. // Mountain View, CA const originLatLng = { lat: 37.422, lng: -122.084058 }; // San Francisco, CA const destinationLatLng = { lat: 37.774929, lng: -122.419415 }; // Define a computeRoutes request. const requestWithLatLngs: google.maps.routes.ComputeRoutesRequest = { origin: originLatLng, destination: destinationLatLng, fields: ['path'], };
জাভাস্ক্রিপ্ট
// Use lat/lng in a directions request. // Mountain View, CA const originLatLng = { lat: 37.422, lng: -122.084058 }; // San Francisco, CA const destinationLatLng = { lat: 37.774929, lng: -122.419415 }; // Define a computeRoutes request. const requestWithLatLngs = { origin: originLatLng, destination: destinationLatLng, fields: ['path'], };
ঠিকানা স্ট্রিং
অ্যাড্রেস স্ট্রিং হলো একটি স্ট্রিং দ্বারা উপস্থাপিত আক্ষরিক ঠিকানা (যেমন "1600 Amphitheatre Parkway, Mountain View, CA")। জিওকোডিং হলো একটি অ্যাড্রেস স্ট্রিংকে অক্ষাংশ এবং দ্রাঘিমাংশের স্থানাঙ্কে রূপান্তর করার প্রক্রিয়া (যেমন অক্ষাংশ ৩৭.৪২৩০২১ এবং দ্রাঘিমাংশ -১২২.০৮৩৭৩৯)।
যখন আপনি কোনো ওয়েপয়েন্টের অবস্থান হিসেবে একটি অ্যাড্রেস স্ট্রিং পাস করেন, তখন Routes লাইব্রেরি অভ্যন্তরীণভাবে স্ট্রিংটিকে জিওকোড করে অক্ষাংশ এবং দ্রাঘিমাংশের স্থানাঙ্কে রূপান্তর করে।
নিম্নলিখিত কোড স্নিপেটটি origin এবং destination জন্য একটি অ্যাড্রেস স্ট্রিং সহ একটি ComputeRoutesRequest তৈরি করা দেখাচ্ছে:
টাইপস্ক্রিপ্ট
// Use address strings in a directions request. const requestWithAddressStrings = { origin: '1600 Amphitheatre Parkway, Mountain View, CA', destination: '345 Spear Street, San Francisco, CA', fields: ['path'], };
জাভাস্ক্রিপ্ট
// Use address strings in a directions request. const requestWithAddressStrings = { origin: '1600 Amphitheatre Parkway, Mountain View, CA', destination: '345 Spear Street, San Francisco, CA', fields: ['path'], };
ঠিকানার জন্য অঞ্চল নির্ধারণ করুন
যদি আপনি কোনো ওয়েপয়েন্টের অবস্থান হিসেবে একটি অসম্পূর্ণ ঠিকানা স্ট্রিং দেন, তাহলে এপিআই ভুল জিওকোডেড অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক ব্যবহার করতে পারে। উদাহরণস্বরূপ, আপনি একটি ড্রাইভিং রুটের জন্য উৎস হিসেবে "টলেডো" এবং গন্তব্য হিসেবে "মাদ্রিদ" উল্লেখ করে একটি অনুরোধ করলেন:
// Define a request with an incomplete address string. const request = { origin: 'Toledo', destination: 'Madrid', };
এই উদাহরণে, "টলেডো"-কে মার্কিন যুক্তরাষ্ট্রের ওহাইও রাজ্যের একটি শহর হিসেবে গণ্য করা হয়েছে, স্পেনের নয়। তাই, অনুরোধটি একটি খালি অ্যারে ফেরত দেয়, যার অর্থ কোনো রুট বিদ্যমান নেই।
আপনি regionCode প্যারামিটারটি অন্তর্ভুক্ত করে একটি নির্দিষ্ট অঞ্চলের প্রতি পক্ষপাতদুষ্ট ফলাফল ফেরত দেওয়ার জন্য API কনফিগার করতে পারেন। এই প্যারামিটারটি একটি ccTLD ("টপ-লেভেল ডোমেইন") দুই-অক্ষরের মান হিসাবে অঞ্চল কোড নির্দিষ্ট করে। কিছু উল্লেখযোগ্য ব্যতিক্রম ছাড়া, বেশিরভাগ ccTLD কোড ISO 3166-1 কোডের অনুরূপ। উদাহরণস্বরূপ, যুক্তরাজ্যের ccTLD হলো "uk" (.co.uk) এবং এর ISO 3166-1 কোড হলো "gb" (যা প্রযুক্তিগতভাবে "The United Kingdom of Great Britain and Northern Ireland" সত্তাটিকে বোঝায়)।
"টলেডো" থেকে "মাদ্রিদ"-এ যাওয়ার দিকনির্দেশনার অনুরোধে যদি regionCode প্যারামিটারটি অন্তর্ভুক্ত থাকে, তবে তা যথাযথ ফলাফল প্রদান করে, কারণ "টলেডো"-কে স্পেনের একটি শহর হিসেবে গণ্য করা হয়:
const request = { origin: 'Toledo', destination: 'Madrid', region: 'es', // Specify the region code for Spain. };
প্লাস কোড
অনেকেরই সুনির্দিষ্ট ঠিকানা থাকে না, যার ফলে তাদের জন্য ডেলিভারি গ্রহণ করা কঠিন হয়ে পড়ে। আবার, যাদের ঠিকানা আছে, তারা হয়তো আরও নির্দিষ্ট কোনো জায়গায়, যেমন বাড়ির পেছনের প্রবেশপথ বা মালামাল বোঝাই করার জায়গায়, ডেলিভারি নিতে পছন্দ করেন।
যেসব ব্যক্তি বা স্থানের কোনো প্রকৃত ঠিকানা নেই, তাদের জন্য প্লাস কোড অনেকটা রাস্তার ঠিকানার মতো। রাস্তার নাম ও নম্বরযুক্ত ঠিকানার পরিবর্তে, প্লাস কোডগুলো অক্ষাংশ/দ্রাঘিমাংশের স্থানাঙ্কের উপর ভিত্তি করে তৈরি হয় এবং সংখ্যা ও অক্ষর হিসেবে প্রদর্শিত হয়।
গুগল প্রত্যেককে এবং সবকিছুকে ঠিকানার সুবিধা দেওয়ার জন্য প্লাস কোড তৈরি করেছে। একটি প্লাস কোড হলো অক্ষাংশ/দ্রাঘিমাংশ স্থানাঙ্ক থেকে প্রাপ্ত একটি এনকোডেড অবস্থান নির্দেশক, যা ১/৮০০০ ডিগ্রি বাই ১/৮০০০ ডিগ্রি (নিরক্ষীয় অঞ্চলে প্রায় ১৪মি x ১৪মি) বা তার চেয়ে ছোট একটি এলাকাকে প্রতিনিধিত্ব করে। যেসব জায়গায় রাস্তার ঠিকানা নেই, অথবা যেখানে ভবনগুলোতে নম্বর দেওয়া নেই বা রাস্তার নাম নেই, সেখানে আপনি রাস্তার ঠিকানার বিকল্প হিসেবে প্লাস কোড ব্যবহার করতে পারেন।
প্লাস কোড অবশ্যই গ্লোবাল কোড বা কম্পাউন্ড কোড হিসাবে ফরম্যাট করতে হবে:
- গ্লোবাল কোড একটি ৪ অক্ষরের এরিয়া কোড এবং ৬ বা তার বেশি অক্ষরের লোকাল কোড দিয়ে গঠিত। উদাহরণস্বরূপ, "1600 Amphitheatre Parkway, Mountain View, CA" ঠিকানার জন্য, গ্লোবাল কোড হল "849V" এবং লোকাল কোড হল "CWC8+R9"। এরপর আপনি সম্পূর্ণ ১০ অক্ষরের প্লাস কোডটি ব্যবহার করে অবস্থান মান "849VCWC8+R9" হিসাবে নির্দিষ্ট করেন।
- যৌগিক কোড একটি ৬ বা ততোধিক অক্ষরের স্থানীয় কোডের সাথে একটি সুস্পষ্ট অবস্থান যুক্ত করে গঠিত হয়। উদাহরণস্বরূপ, "450 Serra Mall, Stanford, CA 94305, USA" ঠিকানাটির স্থানীয় কোড হলো "CRHJ+C3"। একটি যৌগিক ঠিকানার জন্য, স্থানীয় কোডের সাথে ঠিকানার শহর, রাজ্য, জিপ কোড এবং দেশের অংশকে "CRHJ+C3 Stanford, CA 94305, USA" আকারে যুক্ত করুন।
নিম্নলিখিত কোড অংশে প্লাস কোড ব্যবহার করে রুটের উৎস এবং গন্তব্যের জন্য একটি ওয়েপয়েন্ট নির্দিষ্ট করে রুট গণনা করার পদ্ধতি দেখানো হয়েছে:
টাইপস্ক্রিপ্ট
// Use Plus Codes in a directions request. const requestWithPlusCodes: google.maps.routes.ComputeRoutesRequest = { origin: '849VCWC8+R9', // Mountain View, CA destination: 'CRHJ+C3 Stanford, CA 94305, USA', // Stanford, CA fields: ['path'], };
জাভাস্ক্রিপ্ট
// Use Plus Codes in a directions request. const requestWithPlusCodes = { origin: '849VCWC8+R9', // Mountain View, CA destination: 'CRHJ+C3 Stanford, CA 94305, USA', // Stanford, CA fields: ['path'], };