reviewsהשקת Places UI Kit: ספריית רכיבים מוכנה לשימוש בעלות נמוכה, שמאפשרת לכם להוסיף לכל מפה שתבחרו את ממשק המשתמש המוכר של 'מקומות' במפות Google. כדאי לנסות אותו ולשלוח לנו משוב כדי לעזור לנו לעצב את העתיד של GMP.
סקירה כללית על סמנים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אפשר להשתמש בסמנים כדי להציג מיקומים בודדים במפה. במדריך הזה מוסבר איך להשתמש בסמנים מתקדמים. בעזרת סמנים מתקדמים אפשר ליצור סמנים עם ביצועים טובים מאוד ולהתאים אותם אישית, וגם ליצור סמנים נגישים שמגיבים לאירועי קליק ב-DOM ולקלט מהמקלדת. כדי להתאים אישית את הסמנים עוד יותר, אפשר להשתמש בסמנים מתקדמים ב-HTML וב-CSS מותאמים אישית, כולל האפשרות ליצור סמנים מותאמים אישית לחלוטין. באפליקציות תלת-ממד
אפשר לקבוע את הגובה שבו סמן יופיע.
יש תמיכה בסמנים מתקדמים במפות רסטר ובמפות וקטוריות (אבל חלק מהתכונות לא זמינות במפות רסטר).
כדי להשתמש בסמנים מתקדמים, צריך לציין מזהה מפה (אפשר להשתמש ב-DEMO_MAP_ID
).
איך מתחילים לעבוד עם סמנים מתקדמים
התאמה אישית של הצבע, הסולם ותמונת הסמל
אפשר להתאים אישית את הרקע, הגליף והצבע של הגבול של סמן ברירת המחדל, ולשנות את הגודל של הסמן.
החלפת סמל ברירת המחדל של הסמן בתמונה בהתאמה אישית בפורמט SVG או PNG.
יצירת סמני HTML בהתאמה אישית
שימוש ב-HTML וב-CSS מותאמים אישית כדי ליצור סמנים אינטראקטיביים בעלי מראה ייחודי, וליצור אנימציות.
איך גורמים לסמנים להגיב לאירועי קליקים ומקלדת
כדי שסמן יגיב לקליקים ולאירועים במקלדת, מוסיפים click
event listener.
function initMap() {
const map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 37.4239163, lng: -122.0947209},
zoom: 17,
mapId: 'DEMO_MAP_ID',
});
const marker = new google.maps.marker.AdvancedMarkerElement({
map,
position: {lat: 37.4239163, lng: -122.0947209},
});
marker.addListener('click', ({domEvent, latLng}) => {
const {target} = domEvent;
// Handle the click event.
// ...
});
}
הגדרת הגובה של הסמן והתנהגות ההתנגשות
מגדירים את הגובה של סמן כדי שהוא יופיע בצורה נכונה עם רכיבי מפה תלת-ממדיים, ומציינים איך סמן צריך להתנהג כשהוא מתנגש עם סמן אחר או עם תווית של מפה. גובה הסמן נתמך רק במפות וקטוריות.
השלב הבא
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-17 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-17 (שעון UTC)."],[[["\u003cp\u003eAdvanced markers offer highly performant and customizable options for displaying single locations on Google Maps, including custom HTML and CSS for unique designs.\u003c/p\u003e\n"],["\u003cp\u003eThey are accessible, responding to DOM click events and keyboard input for enhanced user interaction.\u003c/p\u003e\n"],["\u003cp\u003eCustomization options include changing color, scale, icon image, and creating custom HTML markers with interactive elements and animations.\u003c/p\u003e\n"],["\u003cp\u003eAltitude control is available for 3D applications, enabling precise marker placement in three-dimensional spaces, although this feature is limited to vector maps.\u003c/p\u003e\n"],["\u003cp\u003eAdvanced markers are compatible with both raster and vector maps, requiring a map ID for implementation, and offer improved performance compared to legacy markers.\u003c/p\u003e\n"]]],["Advanced markers allow customization of map markers, including color, scale, and icons (SVG/PNG). Users can employ custom HTML and CSS for unique designs and animations. Markers can be made interactive via `click` event listeners, handling user clicks and keyboard input. Altitude and collision behavior can be defined for 3D maps. A map ID, like `DEMO_MAP_ID`, is needed, and these advanced markers are available on Android, iOS, and JavaScript platforms, supporting both raster and vector maps.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/advanced-markers/overview \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/advanced-markers/overview \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/advanced-markers/overview \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nUse markers to display single locations on a map. This guide shows you how to\nuse advanced markers. With\nadvanced markers you can create and customize highly\nperformant markers, and make accessible markers that respond to DOM click events\nand keyboard input. For even deeper customization,\nadvanced markers supports the use of custom HTML and CSS,\nincluding the ability to create completely custom markers. For 3D applications\nyou can control the altitude at which a marker appears.\nAdvanced markers are supported on both raster and vector maps (though some features are not available on raster maps).\nA map ID is required to use Advanced Markers (the `DEMO_MAP_ID` can be used).\n| **Tip:** If your map uses [legacy markers](/maps/documentation/javascript/markers), consider [migrating to advanced markers](/maps/documentation/javascript/advanced-markers/migration).\n\n[Get started with advanced markers](/maps/documentation/javascript/advanced-markers/start)\n\nCustomize color, scale, and icon image\n\nCustomize the default marker's background, glyph, and border\ncolor, and adjust marker size.\n\nReplace the default marker icon with a custom SVG or PNG image.\n\nCreate custom HTML markers\n\nUse custom HTML and CSS to create visually distinctive\ninteractive markers, and create animations.\n\nMake markers respond to click and keyboard events\n\nMake a marker respond to clicks and keyboard events by adding a\n`click` event listener. \n\n```javascript\nfunction initMap() {\n const map = new google.maps.Map(document.getElementById('map'), {\n center: {lat: 37.4239163, lng: -122.0947209},\n zoom: 17,\n mapId: 'DEMO_MAP_ID',\n });\n\n const marker = new google.maps.marker.AdvancedMarkerElement({\n map,\n position: {lat: 37.4239163, lng: -122.0947209},\n });\n\n marker.addListener('click', ({domEvent, latLng}) =\u003e {\n const {target} = domEvent;\n // Handle the click event.\n // ...\n });\n}\n```\n\nSet marker altitude and collision behavior\n\nSet the altitude for a marker to make it appear correctly with\n3D map elements, and specify how a marker should behave when it collides with\nanother marker or map label. Marker altitude is only supported on vector maps.\n\nNext step\n\n- [Get started with advanced markers](/maps/documentation/javascript/advanced-markers/start)"]]