নতুন স্থানের পর্যালোচনাগুলিতে স্থানান্তরিত করুন, নতুন স্থান পর্যালোচনাগুলিতে স্থানান্তর করুন, নতুন স্থান পর্যালোচনাগুলিতে স্থানান্তর করুন, নতুন স্থান পর্যালোচনাগুলিতে স্থানান্তর করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ইউরোপিয়ান ইকোনমিক এরিয়া (EEA) ডেভেলপার স্থান পর্যালোচনা আপনাকে আপনার ওয়েব পৃষ্ঠাগুলিতে ব্যবহারকারীর পর্যালোচনা এবং রেটিং যোগ করতে দেয়৷ এই পৃষ্ঠাটি Place
ক্লাস (নতুন) এবং PlacesService
(লেগেসি) এ ব্যবহৃত স্থান পর্যালোচনার মধ্যে পার্থক্য ব্যাখ্যা করে এবং তুলনা করার জন্য কিছু কোড স্নিপেট প্রদান করে।
- যদি অনুরোধে
reviews
ক্ষেত্র নির্দিষ্ট করা থাকে তাহলে যেকোনো getDetails()
অনুরোধের জন্য PlaceResult
অবজেক্টের অংশ হিসেবে PlacesService
(উত্তরাধিকার) PlaceReview
উদাহরণের একটি অ্যারে প্রদান করে। - একটি
fetchFields()
অনুরোধের অংশ হিসাবে Place
(নতুন) Review
ইন্সট্যান্সের একটি অ্যারে প্রদান করে যদি অনুরোধে reviews
ক্ষেত্রটি নির্দিষ্ট করা থাকে।
নিম্নলিখিত সারণীতে Place
শ্রেণী এবং PlacesService
মধ্যে স্থান পর্যালোচনার ব্যবহারে কিছু প্রধান পার্থক্য তালিকাভুক্ত করা হয়েছে:
PlacesService (উত্তরাধিকার) | Place (নতুন) |
---|
PlaceReview ইন্টারফেস | ক্লাস Review |
ফলাফল বস্তু এবং google.maps.places.PlacesServiceStatus প্রতিক্রিয়া পরিচালনা করতে পদ্ধতিগুলির জন্য একটি কলব্যাক ব্যবহার করা প্রয়োজন৷ | প্রতিশ্রুতি ব্যবহার করে, এবং অ্যাসিঙ্ক্রোনাসভাবে কাজ করে। |
পদ্ধতিগুলির জন্য একটি PlacesServiceStatus চেক প্রয়োজন৷ | কোন প্রয়োজনীয় স্থিতি পরীক্ষা, মান ত্রুটি হ্যান্ডলিং ব্যবহার করতে পারেন. আরও জানুন |
PlacesService একটি মানচিত্র বা একটি div উপাদান ব্যবহার করে তাত্ক্ষণিক করা আবশ্যক। | একটি মানচিত্র বা পৃষ্ঠা উপাদানের রেফারেন্স ছাড়াই যেখানে প্রয়োজন সেখানে Place তাত্ক্ষণিক করা যেতে পারে। |
PlaceReview author_name , author_url , এবং profile_photo_url ক্ষেত্রগুলি ব্যবহার করে পর্যালোচনার জন্য অ্যাট্রিবিউশন ডেটা প্রদান করে। | Review একটি AuthorAttribution উদাহরণ ব্যবহার করে পর্যালোচনার জন্য অ্যাট্রিবিউশন ডেটা প্রদান করে। |
কোড তুলনা
এই বিভাগটি লিগ্যাসি PlacesService
এবং নতুন Place
ক্লাসের মধ্যে স্থান পর্যালোচনার মধ্যে পার্থক্য চিত্রিত করতে পাঠ্য অনুসন্ধান পদ্ধতির কোডের তুলনা করে।
স্থান পরিষেবা (উত্তরাধিকার)
নিম্নলিখিত স্নিপেটটি পর্যালোচনা সহ স্থানের বিবরণের জন্য অনুরোধ করতে getDetails()
কল করে এবং একটি তথ্য উইন্ডোতে প্রথম পর্যালোচনা ফলাফল প্রদর্শন করে।
const request = {
placeId: "ChIJpyiwa4Zw44kRBQSGWKv4wgA", // Faneuil Hall Marketplace, Boston, MA
fields: ["name", "formatted_address", "geometry", "reviews"],
};
const service = new google.maps.places.PlacesService(map);
service.getDetails(request, (place, status) => {
if (
status === google.maps.places.PlacesServiceStatus.OK &&
place &&
place.geometry &&
place.geometry.location
) {
// If there are any reviews display the first one.
if (place.reviews && place.reviews.length > 0) {
// Get info for the first review.
let reviewRating = place.reviews[0].rating;
let reviewText = place.reviews[0].text;
let authorName = place.reviews[0].author_name;
let authorUri = place.reviews[0].author_url;
// Format the review using HTML.
contentString =`
<div id="title"><b>${place.name}</b></div>
<div id="address">${place.formatted_address}</div>
<a href="${authorUri}" target="_blank">Author: ${authorName}</a>
<div id="rating">Rating: ${reviewRating} stars</div>
<div id="rating"><p>Review: ${reviewText}</p></div>`;
} else {
contentString = `No reviews were found for ${place.name}`;
}
const infowindow = new google.maps.InfoWindow({
content: contentString,
ariaLabel: place.displayName,
});
// Add a marker.
const marker = new google.maps.Marker({
map,
position: place.geometry.location,
});
// Show the info window.
infowindow.open({
anchor: marker,
map,
});
}
});
ক্লাস করুন (নতুন)
নিম্নলিখিত স্নিপেটটি পর্যালোচনা সহ স্থানের বিশদ বিবরণের জন্য অনুরোধ করতে fetchFields()
পদ্ধতিতে কল করে এবং একটি infowindow-এ প্রথম পর্যালোচনা ফলাফল প্রদর্শন করে।
// Use a place ID to create a new Place instance.
const place = new google.maps.places.Place({
id: "ChIJpyiwa4Zw44kRBQSGWKv4wgA", // Faneuil Hall Marketplace, Boston, MA
});
// Call fetchFields, passing 'reviews' and other needed fields.
await place.fetchFields({
fields: ["displayName", "formattedAddress", "location", "reviews"],
});
// If there are any reviews display the first one.
if (place.reviews && place.reviews.length > 0) {
// Get info for the first review.
let reviewRating = place.reviews[0].rating;
let reviewText = place.reviews[0].text;
let authorName = place.reviews[0].authorAttribution.displayName;
let authorUri = place.reviews[0].authorAttribution.uri;
// Format the review using HTML.
contentString =`
<div id="title"><b>${place.displayName}</b></div>
<div id="address">${place.formattedAddress}</div>
<a href="${authorUri}" target="_blank">Author: ${authorName}</a>
<div id="rating">Rating: ${reviewRating} stars</div>
<div id="rating"><p>Review: ${reviewText}</p></div>`;
} else {
contentString = `No reviews were found for ${place.displayName}`;
}
// Create an infowindow to display the review.
infoWindow = new google.maps.InfoWindow({
content: contentString,
ariaLabel: place.displayName,
});
// Add a marker.
const marker = new google.maps.marker.AdvancedMarkerElement({
map,
position: place.location,
title: place.displayName,
});
// Show the info window.
infoWindow.open({
anchor: marker,
map,
});
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-09-04 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-09-04 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Migrate to the new Place Reviews\n\n\u003cbr /\u003e\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nPlace reviews lets you add user reviews and ratings to your web pages. This page\nexplains the differences between place reviews as used in the `Place` class\n(new) and `PlacesService` (legacy), and provides some code snippets for\ncomparison.\n\n- `PlacesService` (legacy) returns an array of [`PlaceReview`](/maps/documentation/javascript/reference/places-service#PlaceReview) instances as part of the `PlaceResult` object for any `getDetails()` request if the `reviews` field is specified in the request.\n- `Place` (new) returns an array of [`Review`](/maps/documentation/javascript/reference/place#Review) instances as part of a `fetchFields()` request if the `reviews` field is specified in the request.\n\nThe following table lists some of the main differences in the use of place\nreviews between the `Place` class and `PlacesService`:\n\n| [`PlacesService`](/maps/documentation/javascript/reference/places-service) (Legacy) | [`Place`](/maps/documentation/javascript/reference/place) (New) |\n|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`PlaceReview`](/maps/documentation/javascript/reference/places-service#PlaceReview) interface | [`Review`](/maps/documentation/javascript/reference/place#Review) class |\n| Methods require the use of a callback to handle the results object and `google.maps.places.PlacesServiceStatus` response. | Uses Promises, and works asynchronously. |\n| Methods require a `PlacesServiceStatus` check. | No required status check, can use standard error handling. [Learn more](/maps/documentation/javascript/reference/errors). |\n| `PlacesService` must be instantiated using a map or a div element. | `Place` can be instantiated wherever needed, without a reference to a map or page element. |\n| `PlaceReview` returns attribution data for the review using the `author_name`, `author_url`, and `profile_photo_url` fields. | `Review` returns attribution data for the review using an [`AuthorAttribution`](/maps/documentation/javascript/reference/place#AuthorAttribution) instance. |\n\nCode comparison\n---------------\n\nThis section compares code for text search methods to illustrate the differences\nbetween Place reviews in the legacy `PlacesService` and the newer `Place` class.\n\n### Places service (legacy)\n\nThe following snippet calls `getDetails()` to request place details including\nreviews, and displays the first review result in an infowindow. \n\n const request = {\n placeId: \"ChIJpyiwa4Zw44kRBQSGWKv4wgA\", // Faneuil Hall Marketplace, Boston, MA\n fields: [\"name\", \"formatted_address\", \"geometry\", \"reviews\"],\n };\n const service = new google.maps.places.PlacesService(map);\n\n service.getDetails(request, (place, status) =\u003e {\n if (\n status === google.maps.places.PlacesServiceStatus.OK &&\n place &&\n place.geometry &&\n place.geometry.location\n ) {\n // If there are any reviews display the first one.\n if (place.reviews && place.reviews.length \u003e 0) {\n // Get info for the first review.\n let reviewRating = place.reviews[0].rating;\n let reviewText = place.reviews[0].text;\n let authorName = place.reviews[0].author_name;\n let authorUri = place.reviews[0].author_url;\n\n // Format the review using HTML.\n contentString =`\n \u003cdiv id=\"title\"\u003e\u003cb\u003e${place.name}\u003c/b\u003e\u003c/div\u003e\n \u003cdiv id=\"address\"\u003e${place.formatted_address}\u003c/div\u003e\n \u003ca href=\"${authorUri}\" target=\"_blank\"\u003eAuthor: ${authorName}\u003c/a\u003e\n \u003cdiv id=\"rating\"\u003eRating: ${reviewRating} stars\u003c/div\u003e\n \u003cdiv id=\"rating\"\u003e\u003cp\u003eReview: ${reviewText}\u003c/p\u003e\u003c/div\u003e`;\n } else {\n contentString = `No reviews were found for ${place.name}`;\n }\n\n const infowindow = new google.maps.InfoWindow({\n content: contentString,\n ariaLabel: place.displayName,\n });\n\n // Add a marker.\n const marker = new google.maps.Marker({\n map,\n position: place.geometry.location,\n });\n\n // Show the info window.\n infowindow.open({\n anchor: marker,\n map,\n });\n }\n });\n\n- [`getDetails()` reference](/maps/documentation/javascript/reference/places-service#PlacesService.getDetails)\n- [`PlaceReview` interface reference](/maps/documentation/javascript/reference/places-service#PlaceReview)\n\n### Place class (new)\n\nThe following snippet calls [`fetchFields()`](/maps/documentation/javascript/reference/place#Place.fetchFields)\nmethod to request place details including reviews, and displays the first review\nresult in an infowindow. \n\n // Use a place ID to create a new Place instance.\n const place = new google.maps.places.Place({\n id: \"ChIJpyiwa4Zw44kRBQSGWKv4wgA\", // Faneuil Hall Marketplace, Boston, MA\n });\n\n // Call fetchFields, passing 'reviews' and other needed fields.\n await place.fetchFields({\n fields: [\"displayName\", \"formattedAddress\", \"location\", \"reviews\"],\n });\n\n // If there are any reviews display the first one.\n if (place.reviews && place.reviews.length \u003e 0) {\n // Get info for the first review.\n let reviewRating = place.reviews[0].rating;\n let reviewText = place.reviews[0].text;\n let authorName = place.reviews[0].authorAttribution.displayName;\n let authorUri = place.reviews[0].authorAttribution.uri;\n\n // Format the review using HTML.\n contentString =`\n \u003cdiv id=\"title\"\u003e\u003cb\u003e${place.displayName}\u003c/b\u003e\u003c/div\u003e\n \u003cdiv id=\"address\"\u003e${place.formattedAddress}\u003c/div\u003e\n \u003ca href=\"${authorUri}\" target=\"_blank\"\u003eAuthor: ${authorName}\u003c/a\u003e\n \u003cdiv id=\"rating\"\u003eRating: ${reviewRating} stars\u003c/div\u003e\n \u003cdiv id=\"rating\"\u003e\u003cp\u003eReview: ${reviewText}\u003c/p\u003e\u003c/div\u003e`;\n } else {\n contentString = `No reviews were found for ${place.displayName}`;\n }\n\n // Create an infowindow to display the review.\n infoWindow = new google.maps.InfoWindow({\n content: contentString,\n ariaLabel: place.displayName,\n });\n\n // Add a marker.\n const marker = new google.maps.marker.AdvancedMarkerElement({\n map,\n position: place.location,\n title: place.displayName,\n });\n\n // Show the info window.\n infoWindow.open({\n anchor: marker,\n map,\n });\n\n- [See the example](/maps/documentation/javascript/examples/place-reviews)\n- [See the documentation](/maps/documentation/javascript/place-reviews)\n- [`fetchFields()` reference](/maps/documentation/javascript/reference/place#Place.fetchFields)\n- [`Review` class reference](/maps/documentation/javascript/reference/place#Review)"]]