New map styling is coming soon to Google Maps Platform. This update to map styling includes a new default color palette and improvements to map experiences and usability. All map styles will be automatically updated in March 2025. For more information on availability and how to opt in earlier, see New map style for Google Maps Platform.
이미 Place 객체 또는 장소 ID가 있으면 Place.fetchFields를 호출하여 해당 장소에 대한 세부정보를 가져올 수 있습니다. fields 매개변수를 사용하여 하나 이상의 장소 데이터 필드가 쉼표로 구분된 목록을 카멜 표기법으로 지정합니다. 반환된 Place 객체를 사용하여 요청된 필드의 데이터를 가져옵니다.
다음 예에서는 장소 ID를 사용하여 새 Place를 만들고 displayName 및 formattedAddress 필드를 요청하는 Place.fetchFields를 호출한 후 결과 데이터를 콘솔에 로깅합니다.
TypeScript
async function getPlaceDetails(Place) {
// Use place ID to create a new Place instance.
const place = new Place({
id: 'ChIJN1t_tDeuEmsRUsoyG83frY4',
requestedLanguage: 'en', // optional
});
// Call fetchFields, passing the desired data fields.
await place.fetchFields({ fields: ['displayName', 'formattedAddress'] });
// Show the result
console.log(place.displayName);
console.log(place.formattedAddress);
}
async function getPlaceDetails(Place) {
// Use place ID to create a new Place instance.
const place = new Place({
id: "ChIJN1t_tDeuEmsRUsoyG83frY4",
requestedLanguage: "en", // optional
});
// Call fetchFields, passing the desired data fields.
await place.fetchFields({ fields: ["displayName", "formattedAddress"] });
// Show the result
console.log(place.displayName);
console.log(place.formattedAddress);
}