الاطّلاع على رمز المصدر الكامل للمثال
ابحث عن أماكن للاطّلاع على الملخّصات المستندة إلى الذكاء الاصطناعي. بعض عمليات البحث المقترَحة:
- "فندق" لملخّصات الأحياء
- "محطة شحن للمركبات الكهربائية" لملخّصات وسائل الراحة في محطّات شحن المركبات الكهربائية
- أي مطعم أو نشاط تجاري لعرض ملخّصات الأماكن والمراجعات
TypeScript
// Define DOM elements. const mapElement = document.querySelector('gmp-map') as google.maps.MapElement; const placeAutocomplete = document.querySelector( 'gmp-place-autocomplete' ) as google.maps.places.PlaceAutocompleteElement; const summaryPanel = document.getElementById('summary-panel') as HTMLDivElement; const placeName = document.getElementById('place-name') as HTMLElement; const placeAddress = document.getElementById('place-address') as HTMLElement; const tabContainer = document.getElementById('tab-container') as HTMLDivElement; const summaryContent = document.getElementById( 'summary-content' ) as HTMLDivElement; const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement; const flagContentLink = document.getElementById('flag-content-link') as HTMLAnchorElement; let innerMap; let marker: google.maps.marker.AdvancedMarkerElement; async function initMap(): Promise<void> { // Request needed libraries. const [] = await Promise.all([ google.maps.importLibrary('marker'), google.maps.importLibrary('places'), ]); innerMap = mapElement.innerMap; innerMap.setOptions({ mapTypeControl: false, streetViewControl: false, fullscreenControl: false, }); // Bind autocomplete bounds to map bounds. google.maps.event.addListener(innerMap, 'bounds_changed', async () => { placeAutocomplete.locationRestriction = innerMap.getBounds(); }); // Create the marker. marker = new google.maps.marker.AdvancedMarkerElement({ map: innerMap, }); // Handle selection of an autocomplete result. // prettier-ignore // @ts-ignore placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => { const place = placePrediction.toPlace(); // Fetch all summary fields. await place.fetchFields({ fields: [ 'displayName', 'formattedAddress', 'location', 'generativeSummary', 'neighborhoodSummary', 'reviewSummary', 'evChargeAmenitySummary', ], }); // Update the map viewport and position the marker. if (place.viewport) { innerMap.fitBounds(place.viewport); } else { innerMap.setCenter(place.location); innerMap.setZoom(17); } marker.position = place.location; // Update the panel UI. updateSummaryPanel(place); } ); } function updateSummaryPanel(place: google.maps.places.Place) { // Reset UI summaryPanel.classList.remove('hidden'); tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements. summaryContent.textContent = ''; aiDisclosure.textContent = ''; placeName.textContent = place.displayName || ''; placeAddress.textContent = place.formattedAddress || ''; let firstTabActivated = false; /** * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment). */ const createTab = ( label: string, content: string | Node, disclosure: string, flagUrl: string ) => { const btn = document.createElement('button'); btn.className = 'tab-button'; btn.textContent = label; btn.onclick = () => { // Do nothing if the tab is already active. if (btn.classList.contains('active')) { return; } // Manage the active class state. document .querySelectorAll('.tab-button') .forEach((b) => b.classList.remove('active')); btn.classList.add('active'); if (typeof content === 'string') { summaryContent.textContent = content; } else { summaryContent.replaceChildren(content.cloneNode(true)); } // Set the disclosure text. aiDisclosure.textContent = disclosure || 'AI-generated content.'; // Add the content flag URI. if (flagUrl) { flagContentLink.href = flagUrl; flagContentLink.textContent = "Report an issue" } }; tabContainer.appendChild(btn); // Auto-select the first available summary. if (!firstTabActivated) { btn.click(); firstTabActivated = true; } }; // --- 1. Generative Summary (Place) --- //@ts-ignore if (place.generativeSummary?.overview) { createTab( 'Overview', //@ts-ignore place.generativeSummary.overview, //@ts-ignore place.generativeSummary.disclosureText, //@ts-ignore place.generativeSummary.flagContentURI ); } // --- 2. Review Summary --- //@ts-ignore if (place.reviewSummary?.text) { createTab( 'Reviews', //@ts-ignore place.reviewSummary.text, //@ts-ignore place.reviewSummary.disclosureText, //@ts-ignore place.reviewSummary.flagContentURI ); } // --- 3. Neighborhood Summary --- //@ts-ignore if (place.neighborhoodSummary?.overview?.content) { createTab( 'Neighborhood', //@ts-ignore place.neighborhoodSummary.overview.content, //@ts-ignore place.neighborhoodSummary.disclosureText, //@ts-ignore place.neighborhoodSummary.flagContentURI ); } // --- 4. EV Amenity Summary (uses content blocks)) --- //@ts-ignore if (place.evChargeAmenitySummary) { //@ts-ignore const evSummary = place.evChargeAmenitySummary; const evContainer = document.createDocumentFragment(); // Helper to build a safe DOM section for EV categories. const createSection = (title: string, text: string) => { const wrapper = document.createElement('div'); wrapper.style.marginBottom = '15px'; // Or use a CSS class const titleEl = document.createElement('strong'); titleEl.textContent = title; const textEl = document.createElement('div'); textEl.textContent = text; wrapper.appendChild(titleEl); wrapper.appendChild(textEl); return wrapper; }; // Check and append each potential section if (evSummary.overview?.content) { evContainer.appendChild( createSection('Overview', evSummary.overview.content) ); } if (evSummary.coffee?.content) { evContainer.appendChild( createSection('Coffee', evSummary.coffee.content) ); } if (evSummary.restaurant?.content) { evContainer.appendChild( createSection('Food', evSummary.restaurant.content) ); } if (evSummary.store?.content) { evContainer.appendChild( createSection('Shopping', evSummary.store.content) ); } // Only add the tab if the container has children if (evContainer.hasChildNodes()) { createTab( 'EV Amenities', evContainer, // Passing a Node instead of string evSummary.disclosureText, evSummary.flagContentURI ); } } // Safely handle the empty state. if (!firstTabActivated) { const msg = document.createElement('em'); msg.textContent = 'No AI summaries are available for this specific location.'; summaryContent.replaceChildren(msg); aiDisclosure.textContent = ''; } } initMap();
JavaScript
// Define DOM elements. const mapElement = document.querySelector('gmp-map'); const placeAutocomplete = document.querySelector('gmp-place-autocomplete'); const summaryPanel = document.getElementById('summary-panel'); const placeName = document.getElementById('place-name'); const placeAddress = document.getElementById('place-address'); const tabContainer = document.getElementById('tab-container'); const summaryContent = document.getElementById('summary-content'); const aiDisclosure = document.getElementById('ai-disclosure'); const flagContentLink = document.getElementById('flag-content-link'); let innerMap; let marker; async function initMap() { // Request needed libraries. const [] = await Promise.all([ google.maps.importLibrary('marker'), google.maps.importLibrary('places'), ]); innerMap = mapElement.innerMap; innerMap.setOptions({ mapTypeControl: false, streetViewControl: false, fullscreenControl: false, }); // Bind autocomplete bounds to map bounds. google.maps.event.addListener(innerMap, 'bounds_changed', async () => { placeAutocomplete.locationRestriction = innerMap.getBounds(); }); // Create the marker. marker = new google.maps.marker.AdvancedMarkerElement({ map: innerMap, }); // Handle selection of an autocomplete result. // prettier-ignore // @ts-ignore placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => { const place = placePrediction.toPlace(); // Fetch all summary fields. await place.fetchFields({ fields: [ 'displayName', 'formattedAddress', 'location', 'generativeSummary', 'neighborhoodSummary', 'reviewSummary', 'evChargeAmenitySummary', ], }); // Update the map viewport and position the marker. if (place.viewport) { innerMap.fitBounds(place.viewport); } else { innerMap.setCenter(place.location); innerMap.setZoom(17); } marker.position = place.location; // Update the panel UI. updateSummaryPanel(place); }); } function updateSummaryPanel(place) { // Reset UI summaryPanel.classList.remove('hidden'); tabContainer.innerHTML = ''; // innerHTML is OK here since we're clearing known child elements. summaryContent.textContent = ''; aiDisclosure.textContent = ''; placeName.textContent = place.displayName || ''; placeAddress.textContent = place.formattedAddress || ''; let firstTabActivated = false; /** * Safe Helper: Accepts either a text string or a DOM Node (like a div or DocumentFragment). */ const createTab = (label, content, disclosure, flagUrl) => { const btn = document.createElement('button'); btn.className = 'tab-button'; btn.textContent = label; btn.onclick = () => { // Do nothing if the tab is already active. if (btn.classList.contains('active')) { return; } // Manage the active class state. document .querySelectorAll('.tab-button') .forEach((b) => b.classList.remove('active')); btn.classList.add('active'); if (typeof content === 'string') { summaryContent.textContent = content; } else { summaryContent.replaceChildren(content.cloneNode(true)); } // Set the disclosure text. aiDisclosure.textContent = disclosure || 'AI-generated content.'; // Add the content flag URI. if (flagUrl) { flagContentLink.href = flagUrl; flagContentLink.textContent = "Report an issue"; } }; tabContainer.appendChild(btn); // Auto-select the first available summary. if (!firstTabActivated) { btn.click(); firstTabActivated = true; } }; // --- 1. Generative Summary (Place) --- //@ts-ignore if (place.generativeSummary?.overview) { createTab('Overview', //@ts-ignore place.generativeSummary.overview, //@ts-ignore place.generativeSummary.disclosureText, //@ts-ignore place.generativeSummary.flagContentURI); } // --- 2. Review Summary --- //@ts-ignore if (place.reviewSummary?.text) { createTab('Reviews', //@ts-ignore place.reviewSummary.text, //@ts-ignore place.reviewSummary.disclosureText, //@ts-ignore place.reviewSummary.flagContentURI); } // --- 3. Neighborhood Summary --- //@ts-ignore if (place.neighborhoodSummary?.overview?.content) { createTab('Neighborhood', //@ts-ignore place.neighborhoodSummary.overview.content, //@ts-ignore place.neighborhoodSummary.disclosureText, //@ts-ignore place.neighborhoodSummary.flagContentURI); } // --- 4. EV Amenity Summary (uses content blocks)) --- //@ts-ignore if (place.evChargeAmenitySummary) { //@ts-ignore const evSummary = place.evChargeAmenitySummary; const evContainer = document.createDocumentFragment(); // Helper to build a safe DOM section for EV categories. const createSection = (title, text) => { const wrapper = document.createElement('div'); wrapper.style.marginBottom = '15px'; // Or use a CSS class const titleEl = document.createElement('strong'); titleEl.textContent = title; const textEl = document.createElement('div'); textEl.textContent = text; wrapper.appendChild(titleEl); wrapper.appendChild(textEl); return wrapper; }; // Check and append each potential section if (evSummary.overview?.content) { evContainer.appendChild(createSection('Overview', evSummary.overview.content)); } if (evSummary.coffee?.content) { evContainer.appendChild(createSection('Coffee', evSummary.coffee.content)); } if (evSummary.restaurant?.content) { evContainer.appendChild(createSection('Food', evSummary.restaurant.content)); } if (evSummary.store?.content) { evContainer.appendChild(createSection('Shopping', evSummary.store.content)); } // Only add the tab if the container has children if (evContainer.hasChildNodes()) { createTab('EV Amenities', evContainer, // Passing a Node instead of string evSummary.disclosureText, evSummary.flagContentURI); } } // Safely handle the empty state. if (!firstTabActivated) { const msg = document.createElement('em'); msg.textContent = 'No AI summaries are available for this specific location.'; summaryContent.replaceChildren(msg); aiDisclosure.textContent = ''; } } initMap();
CSS
/* Reuse existing map height */ gmp-map { height: 100%; } html, body { height: 100%; margin: 0; padding: 0; } /* Existing Autocomplete Card Style */ .place-autocomplete-card { background-color: #fff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; margin: 10px; padding: 15px; font-family: Roboto, sans-serif; font-size: 1rem; } gmp-place-autocomplete { width: 300px; } /* New: Summary Panel Styles */ .summary-card { background-color: #fff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; margin: 10px; padding: 0; /* Padding handled by children */ font-family: Roboto, sans-serif; width: 350px; max-height: 80vh; /* Prevent overflow on small screens */ overflow-y: auto; display: flex; flex-direction: column; } .hidden { display: none; } #place-header { padding: 15px; background-color: #f8f9fa; border-bottom: 1px solid #ddd; } #place-header h2 { margin: 0 0 5px 0; font-size: 1.2rem; } #place-address { margin: 0; color: #555; font-size: 0.9rem; } /* Tab Navigation */ .tab-container { display: flex; border-bottom: 1px solid #ddd; background-color: #fff; } .tab-button { flex: 1; background: none; border: none; padding: 10px; cursor: pointer; font-weight: 500; color: #555; border-bottom: 3px solid transparent; } .tab-button:hover { background-color: #f1f1f1; } .tab-button.active { font-weight: bold; border-bottom: 3px solid #000000; } .tab-button.active:hover { background-color: #ffffff; cursor: default; } /* Content Area */ .content-area { padding: 15px; line-height: 1.5; font-size: 0.95rem; color: #333; } .disclosure-footer { font-size: 0.75rem; color: #666; padding: 10px 15px; border-top: 1px solid #eee; font-style: italic; } .flag-content-link { font-size: 0.75rem; color: #666; padding: 10px 15px; border-top: 1px solid #eee; } /* Reuse existing map height */ gmp-map { height: 100%; } html, body { height: 100%; margin: 0; padding: 0; } /* Existing Autocomplete Card Style */ .place-autocomplete-card { background-color: #fff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; margin: 10px; padding: 15px; font-family: Roboto, sans-serif; font-size: 1rem; } gmp-place-autocomplete { width: 300px; } /* New: Summary Panel Styles */ .summary-card { background-color: #fff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; margin: 10px; padding: 0; /* Padding handled by children */ font-family: Roboto, sans-serif; width: 350px; max-height: 80vh; /* Prevent overflow on small screens */ overflow-y: auto; display: flex; flex-direction: column; } .hidden { display: none; } #place-header { padding: 15px; background-color: #f8f9fa; border-bottom: 1px solid #ddd; } #place-header h2 { margin: 0 0 5px 0; font-size: 1.2rem; } #place-address { margin: 0; color: #555; font-size: 0.9rem; } /* Tab Navigation */ .tab-container { display: flex; border-bottom: 1px solid #ddd; background-color: #fff; } .tab-button { flex: 1; background: none; border: none; padding: 10px; cursor: pointer; font-weight: 500; color: #555; border-bottom: 3px solid transparent; } .tab-button:hover { background-color: #f1f1f1; } .tab-button.active { font-weight: bold; border-bottom: 3px solid #000000; } .tab-button.active:hover { background-color: #ffffff; cursor: default; } /* Content Area */ .content-area { padding: 15px; line-height: 1.5; font-size: 0.95rem; color: #333; } .disclosure-footer { font-size: 0.75rem; color: #666; padding: 10px 15px; border-top: 1px solid #eee; font-style: italic; } .flag-content-link { font-size: 0.75rem; color: #666; padding: 10px 15px; }
HTML
<html>
<head>
<title>AI Place Summaries</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<!-- prettier-ignore -->
<script>(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: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
</head>
<body>
<gmp-map center="37.805, -122.425" zoom="14" map-id="DEMO_MAP_ID">
<!-- Search Input Card -->
<div
class="place-autocomplete-card"
slot="control-inline-start-block-start">
<p>Search for a place with AI summaries:</p>
<gmp-place-autocomplete></gmp-place-autocomplete>
</div>
<!-- Summary text panel (initially hidden) -->
<div
id="summary-panel"
class="summary-card hidden"
slot="control-inline-end-block-start">
<div id="place-header">
<h2 id="place-name"></h2>
<p id="place-address"></p>
</div>
<!-- Tabs for toggling summary types -->
<div class="tab-container" id="tab-container"></div>
<!-- Content display area -->
<div id="summary-content" class="content-area"></div>
<!-- Legal/AI Disclosure -->
<div id="ai-disclosure" class="disclosure-footer"></div>
<!-- Flag content link -->
<a id="flag-content-link" class="flag-content-link"></a>
</div>
</gmp-map>
</body>
</html>تجربة عيّنة
الملخّصات المستنِدة إلى الذكاء الاصطناعي هي نظرة عامة على مكان أو منطقة تقدّم معلومات مفيدة حول أماكن معيّنة والمنطقة المحيطة بها والمراجعات المرتبطة بها. هناك ثلاثة أنواع مختلفة من الملخّصات المستندة إلى الذكاء الاصطناعي:
-
ملخّص المكان: هو نظرة عامة موجزة تتألف من 100 حرف ومخصّصة لرقم تعريف مكان معيّن، ويتم فيها تجميع العديد من أنواع البيانات المختلفة في لقطة عالية المستوى للمكان.
-
ملخّص المراجعات: ملخّص من إنشاء الذكاء الاصطناعي لمكان معيّن استنادًا إلى مراجعات المستخدمين فقط
-
ملخّص المنطقة: هو ملخّص من إنشاء الذكاء الاصطناعي للمنطقة المحيطة بمكان ما، ويقدّم سياقًا إضافيًا يشمل نقاط الاهتمام القريبة. يمكن أن تكون ملخّصات المناطق أحد النوعَين التاليَين:
-
ملخّص الحي: نظرة عامة شاملة على نقاط الاهتمام القريبة للأماكن التي تحمل الأنواع
premiseوstreet_addressوجميع الأنواع في الفئتَين سكن وأماكن إقامة -
ملخّص وسائل الراحة في محطات شحن المركبات الكهربائية: نظرة عامة شاملة على نقاط الاهتمام القريبة للأماكن التي تحمل النوع
electric_vehicle_charging_station.
-
استرداد ملخّصات مستندة إلى الذكاء الاصطناعي
لاسترداد وعرض الملخّصات المستندة إلى الذكاء الاصطناعي، اتّبِع الخطوات التالية:
-
const { Place } = await google.maps.importLibrary("places");
الحصول على مثيل
Placeيوضّح المقتطف التالي كيفية إنشاء مثيلPlaceمن معرّف مكان:const place = new Place("ChIJaYaXFTqq3oARNy537Kb_W_c");
في طلبك إلى
place.fetchFields()، حدِّد الحقول الخاصة بأنواع الملخّصات التي تريد استخدامها. في المقتطف التالي، يتم طلب جميع حقول الملخّص:await place.fetchFields({ fields: [ 'generativeSummary', 'neighborhoodSummary', 'reviewSummary', 'evChargeAmenitySummary' // Include other fields as needed. ] });
يمكنك استرداد بيانات الملخّص من خلال الوصول إلى السمات
generativeSummaryوneighborhoodSummaryوreviewSummaryوevChargeAmenitySummaryعلى التوالي. يوضّح المقتطف التالي كيفية استرداد النظرة العامة منgenerativeSummary.const summaryText = place.generativeSummary.overview;
بما أنّ الملخّصات المستندة إلى الذكاء الاصطناعي غير متاحة في بعض الأماكن، احرص على التأكّد من توفّر البيانات المطلوبة قبل عرضها للمستخدمين. يستخدم المقتطف التالي عبارة if للتحقّق من وجود generativeSummary:
if (place.generativeSummary) { overviewText = place.generativeSummary.overview; } else { overviewText = 'No summary is available.'; }
يمكنك بدلاً من ذلك استخدام عامل تشغيل nullish للتحقّق من توفّر ملخّص بشكلٍ موجز:
const overviewText = place.generativeSummary.overview ?? 'No summary is available.';
عرض الإشارات المطلوبة
يجب أن تكون جميع الملخّصات المستندة إلى الذكاء الاصطناعي والمعروضة في تطبيقك مصحوبة بالإشارة المناسبة إلى المصدر وفقًا لسياسات Google ومعاييرها. لمزيد من المعلومات، يُرجى الاطّلاع على السياسات وبيانات المصدر الخاصة بواجهة برمجة التطبيقات JavaScript لخرائط Google.
ملخّصات الأماكن
ملخّصات الأماكن هي عبارة عن نظرات عامة موجزة تتألف من 100 حرف ومخصّصة لمعرّف مكان معيّن، وذلك بهدف تقديم لمحة عامة عن المكان. قد تُبرز ملخّصات الأماكن الأطعمة أو الخدمات أو السلع الرائجة التي يمكن شراؤها في موقع جغرافي معيّن:
-
"مطعم في Forum Shops يقدّم كميات كبيرة من المأكولات الإيطالية التقليدية في مكان غير رسمي"
-
"صالون أنيق يقدّم خدمات قص الشعر وتلوينه، بالإضافة إلى تجفيفه"
-
"متجر كبير يضمّ العديد من البائعين الذين يعرضون مجموعة متنوعة من قطع الديكور والأثاث والملابس القديمة."
تتوفّر ملخّصات الأماكن لأنواع الأماكن المعروضة في الأنواع المتوافقة ضمن الفئات الثقافة والترفيه والاستجمام والمأكولات والمشروبات والتسوّق والخدمات والرياضة.
تتوفّر ملخّصات الأماكن لنقاط الاهتمام باللغات والمناطق التالية:
| اللغة | المنطقة |
|---|---|
| الإنجليزية |
الهند الولايات المتحدة |
طلب ملخّص عن مكان
لطلب ملخّص من إنشاء الذكاء الاصطناعي لمكان، عليك تضمين الحقل generativeSummary عند طلب fetchFields():
await place.fetchFields({ fields: [ 'generativeSummary', // Include other fields as needed. ], });
استخدِم السمة generativeSummary
لاسترداد ملخّصات الأماكن. يسترد المقتطف التالي نص النظرة العامة وبيان الإفصاح من generativeSummary:
if (place.generativeSummary) { console.log("Place Overview:", place.generativeSummary.overview); console.log("Disclosure:", place.generativeSummary.disclosureText); }
ملخّصات المراجعات
ملخّصات المراجعات هي ملخّصات يتم إنشاؤها استنادًا إلى مراجعات المستخدمين فقط. من خلال تجميع العناصر الأساسية في مراجعات المستخدمين، مثل سمات المكان وآراء المراجعين، تقدّم ملخّصات المراجعات إحصاءات عالية المستوى وتساعد المستخدمين في اتخاذ قرارات مدروسة.
على سبيل المثال، يتضمّن ملخّص مراجعات حول مبنى Ferry في سان فرانسيسكو معلومات تتراوح بين الطعام والتسوّق والإطلالات والأجواء:
"يقول الزوّار إنّ هذا المعلم التاريخي يقدّم مجموعة متنوعة من المتاجر والمطاعم وسوقًا للمزارعين، ويشيد الكثيرون بالإطلالات على الخليج والمدينة. كما يشدّدون على الأجواء المفعمة بالحيوية وسهولة الوصول إلى وجهات أخرى عبر العبّارة وفرصة الاستفادة من الأنشطة التجارية المحلية."
تتوفّر ملخّصات المراجعات لنقاط الاهتمام باللغات والمناطق التالية:
| اللغة | المنطقة |
|---|---|
| الإنجليزية | الأرجنتين والإكوادور والبرازيل والبرتغال والمكسيك والمملكة المتحدة والهند والولايات المتحدة وأوروغواي وإسبانيا وإيطاليا وباراغواي وبيرو وبوليفيا وتشيلي وجمهورية الدومينيكان وغواتيمالا وفنزويلا وكندا وكولومبيا وكوستاريكا ونيكاراغوا وهندوراس واليابان |
| اليابانية | اليابان |
| البرتغالية | البرازيل |
| الإسبانية | الأرجنتين والإكوادور والبرازيل والبرتغال والسلفادور والمكسيك وباراغواي وبنما وبورتوريكو وبوليفيا وبيرو وتشيلي وجمهورية الدومينيكان وغواتيمالا وفنزويلا وكوستاريكا وكولومبيا ونيكاراغوا وهندوراس |
طلب ملخّص للمراجعات
لطلب ملخّص للمراجعة، أدرِج الحقل reviewSummary عند استدعاء fetchFields():
await place.fetchFields({ fields: [ 'reviewSummary', // Include other fields as needed. ], });
استخدِم السمة
reviewSummary
لاسترداد ملخّصات المراجعات. لاسترداد ملخّصات المراجعات، يمكنك الوصول إلى السمة reviewSummary.text. يسترد المقتطف التالي النص من reviewSummary.
if (place.reviewSummary) { console.log("Place Review Summary:", place.reviewSummary.text); }
ملخّصات المناطق
يتم إنشاء ملخّصات المناطق للمنطقة المحيطة بمكان معيّن. تقدّم ملخّصات المناطق سياقًا إضافيًا حول موقع جغرافي معيّن، بما في ذلك نقاط الاهتمام القريبة، حتى يتمكّن المستخدمون من اتخاذ قرار أكثر استنارة بشأن المكان الذي يريدون الذهاب إليه والأنشطة التي يريدون ممارستها عند وصولهم. على سبيل المثال، عند زيارة مدينة جديدة، يمكنك الاطّلاع على ملخّص عن الحي الذي يقع فيه الفندق للتعرّف أكثر على المنطقة المحيطة:
-
"تقع هذه المنطقة النابضة بالحياة في سان فرانسيسكو، والتي تجمع بين حيّي نورث بيتش والحي الصيني، في الشمال الغربي من الحي المالي، وتضمّ معالم أدبية وأماكن جذب ثقافية فريدة ومطاعم متنوّعة. تشمل الأماكن البارزة مكتبة "سيتي لايتس" الشهيرة ومتحف التلفريك الرائع وشوارع الحي الصيني المزدحمة."
إذا كنت تفكّر في شحن مركبة كهربائية، يمكنك الاطّلاع على ملخّص من إنشاء الذكاء الاصطناعي لمحطة شحن المركبات الكهربائية لمعرفة المزيد عن المنطقة المحيطة:
-
"توفّر هذه المنطقة مجموعة من خيارات تناول الطعام على بُعد 9 دقائق سيرًا على الأقدام، بما في ذلك ستاربكس وسوشي جين وسيفواي".
بالإضافة إلى وصف المنطقة، تتضمّن الاستجابة أيضًا قائمة بحالات Place للأماكن المشار إليها في الوصف. يمكنك طلب المزيد من التفاصيل لكل مكان من خلال استدعاء fetchFields() على حالات Place هذه.
يتوفّر نوعان من ملخّصات المناطق المستندة إلى الذكاء الاصطناعي:
-
ملخّص الحي: نظرة عامة شاملة على نقاط الاهتمام القريبة للأماكن التي تحمل الأنواع
premiseوstreet_addressوجميع الأنواع في الفئتَين سكن وإقامة -
ملخّص وسائل الراحة في محطات شحن المركبات الكهربائية: نظرة عامة شاملة على نقاط الاهتمام القريبة من الأماكن التي تحمل النوع
electric_vehicle_charging_station.
تتوفّر ملخّصات المناطق لنقاط الاهتمام باللغات والمناطق التالية:
| اللغة | المنطقة |
|---|---|
| الإنجليزية | الولايات المتحدة |
طلب ملخّص عن الحي
يمكنك طلب ملخّصات عن الأحياء للأماكن التي تحمل الأنواع premise وstreet_address وجميع الأنواع في الفئتَين سكن وأماكن إقامة. لطلب ملخّص عن حيّ، أدرِج الحقل
neighborhoodSummary عند طلب fetchFields():
await place.fetchFields({ fields: [ 'neighborhoodSummary', // Include other fields as needed. ], });
استخدِم السمة neighborhoodSummary
لاسترداد ملخّصات الأحياء. لاسترداد ملخّصات الأحياء، يمكنك الوصول إلى السمة neighborhoodSummary.content للحصول على النص.
يسترد المقتطف التالي محتوى neighborhoodSummary:
if (place.neighborhoodSummary) { console.log("Place Neighborhood Summary:", place.neighborhoodSummary.overview.content); }
طلب ملخّص عن وسائل الراحة في محطة شحن للمركبات الكهربائية
يمكنك طلب ملخّصات عن وسائل الراحة في محطات شحن المركبات الكهربائية للأماكن التي تحمل النوع electric_vehicle_charging_station. تقدّم ملخّصات وسائل الراحة في محطّات شحن المركبات الكهربائية أربعة أنواع من الملخّصات: overview وcoffee وrestaurant وstore. ولهذا السبب، يكون هيكل البيانات عبارة عن مصفوفة من العناصر، يحتوي كل منها على ملخّص. لطلب ملخّص عن وسائل الراحة في محطة شحن المركبات الكهربائية، أدرِج الحقل evChargeAmenitySummary عند طلب fetchFields():
await place.fetchFields({ fields: [ 'evChargeAmenitySummary', // Include other fields as needed. ], });
استخدِم السمة evChargeAmenitySummary
لاسترداد ملخّصات وسائل الراحة في محطات شحن المركبات الكهربائية. لاسترداد نص من الملخّصات، يمكنك الوصول إلى السمة content الخاصة بالسمات evChargeAmenitySummary.overview وevChargeAmenitySummary.coffee وevChargeAmenitySummary.restaurant وevChargeAmenitySummary.store.
يسترد المقتطف التالي محتوى evChargeAmenitySummary:
// overview, coffee, restaurant, store. if (place.evChargeAmenitySummary) { console.log("Place EVCS Amenity Summary:", place.evChargeAmenitySummary.overview.content); console.log("Coffee:", place.evChargeAmenitySummary.coffee.content); console.log("Restaurants:", place.evChargeAmenitySummary.restaurant.content); console.log("Stores:", place.evChargeAmenitySummary.store.content); }