constelevationService=google.maps.ElevationService();constlocations=[{lat:27.986065,lng:86.922623}];constcallback=(results,status)=>{if(status==='OK'){console.log(results);}else{// handle this case}};elevationService.getElevationForLocation({locations},callback);
বর্তমানে প্রতিশ্রুতি শুধুমাত্র getPlacePredictions() এ সমর্থিত। ↩
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-08-15 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eAsynchronous methods within the Google Maps JavaScript API predominantly return Promises for efficient handling of operations.\u003c/p\u003e\n"],["\u003cp\u003eNumerous Google Maps services, including Directions, Distance Matrix, Elevation, Geocoder, and Streetview, utilize Promises in their methods.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can employ async/await, then/catch/finally, or traditional callbacks to manage asynchronous operations and responses effectively.\u003c/p\u003e\n"],["\u003cp\u003eWhile Places generally do not utilize Promises, the \u003ccode\u003egetPlacePredictions()\u003c/code\u003e method within the Places AutocompleteService does offer partial Promise support.\u003c/p\u003e\n"],["\u003cp\u003eBeginning in 2020, all newly introduced APIs within the Google Maps JavaScript API exclusively support Promises for asynchronous operations.\u003c/p\u003e\n"]]],[],null,["Asynchronous methods throughout Google Maps JavaScript API return\n[Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n\nSupport\n\n| API | Methods return Promises |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|\n| [Directions](/maps/documentation/javascript/directions) | Yes |\n| [Distance Matrix](/maps/documentation/javascript/reference/distance-matrix \"Reference documentation for Distance Matrix service\") | Yes |\n| [Elevation](/maps/documentation/javascript/reference/elevation \"Reference documentation for Elevation service\") | Yes |\n| [Geocoder](/maps/documentation/javascript/reference/geocoder \"Reference documentation for Geocoder service\") | Yes |\n| [Maximum Zoom Imagery](/maps/documentation/javascript/reference/max-zoom \"Reference documentation for MaxZoom service\") | Yes |\n| Places | No |\n| [Places AutocompleteService](/maps/documentation/javascript/reference/places-autocomplete-service#AutocompleteService \"Reference documentation for Places Autocomplete service\") | Partial^[1](#fn1)^ |\n| [Streetview](/maps/documentation/javascript/reference/street-view \"Reference documentation for StreetView service\") | Yes |\n\n| **Note:** Starting in 2020, new APIs only support Promises.\n\nUsage \n\nSee this\n[guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_Promises)\non using Promises or the examples below for making asynchronous method calls\nwith Google Maps JavaScript API.\n\nAsync and await\n\nThe\n[await operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)\nis used to wait for a Promise. It can only be used inside an async function. \n\n const app = async () =\u003e {\n const elevationService = google.maps.ElevationService();\n const locations = [{lat: 27.986065, lng:86.922623}];\n\n const response = await elevationService.getElevationForLocation({locations});\n console.log(response.results);\n };\n\n app();\n\nThen, catch, and finally\n\nThe\n[Promise object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#Instance_methods)\nhas `then`, `catch`, and `finally` methods that take callback functions. \n\n const elevationService = google.maps.ElevationService();\n const locations = [{lat: 27.986065, lng:86.922623}];\n\n const promise = elevationService.getElevationForLocation({locations});\n\n promise\n .then((response) =\u003e {\n console.log(response.results);\n })\n .catch((error) =\u003e {\n console.log(error);\n });\n .finally(() =\u003e {\n console.log('done');\n });\n\nAsync callback pattern\n\nThe\n[callback pattern](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Introducing#Async_callbacks)\nis still valid and supported. \n\n const elevationService = google.maps.ElevationService();\n const locations = [{lat: 27.986065, lng:86.922623}];\n\n const callback = (results, status) =\u003e {\n if (status === 'OK') {\n console.log(results);\n } else {\n // handle this case\n }\n };\n\n elevationService.getElevationForLocation({locations}, callback);\n\n**Note:** Starting in 2020, new APIs only support Promises. \n\n*** ** * ** ***\n\n1. Currently Promises are only supported in `getPlacePredictions()`. [↩](#fnref1)"]]