אפשר להחיל עיצוב מותאם אישית באמצעות הצהרות סגנון JSON מוטמעות על:
מפת ברירת המחדל.
סוגי מפות שמשתמש יכול לעבור ביניהם בתוך מסגרת מפה אחת.
ציון סגנונות לתכונות
כדי להחיל סגנונות על תכונות ורכיבים שונים במפה, יוצרים מערך של אובייקטים MapTypeStyle שמגדירים את הסגנון של המפה.
המערך נראה כך:
varstylesArray=[{featureType:'',elementType:'',stylers:[{color:''},{visibility:''},// Add any stylers you need.]},{featureType:'',// Add the stylers you need.}]
בדוגמה הבאה מוצגת מפה שמוגדרת כברירת מחדל עם טקסט וסמלים בצבעים בהירים על רקע כהה (כלומר, מצב כהה). כדי לראות את דוגמת הקוד, עוברים אל Styled Maps - Night Mode code sample.
כדי לשנות את הסגנונות של מפת ברירת המחדל, צריך להגדיר את המאפיין styles של המפה באובייקט MapOptions למערך הסגנונות שלכם כשמתקיימים התנאים הבאים:
המפה נוצרת.
או כשמפעילים את השיטה Map.setOptions.
שינויים בתוויות ובכבישים משפיעים על כל סוגי המפות, כולל מפות טופוגרפיות, מפות לוויין, מפות היברידיות ומפות דרכים רגילות.
החלת סגנונות על סוג מפה
בתמונה הבאה מוצג סוג מפה שנוסף שנקרא מפה עם סגנון בפקד בפינה הימנית העליונה של המפה. כדי לראות את קוד לדוגמה, עוברים אל Styled Map Types.
כדי ליצור סוג מפה עם סגנון, מגדירים את מערך הסגנונות לאובייקט StyledMapType. יצירת סוג מפה חדש עם סגנון לא משפיעה על הסגנון של סוגי המפות שמוגדרים כברירת מחדל.
[[["התוכן קל להבנה","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-07-09 (שעון UTC)."],[[["Customize the appearance of your maps using embedded JSON style declarations for the default map and selectable map types."],["Style features and elements within the map by creating an array of `MapTypeStyle` objects defining the desired appearance, with the `featureType`, `elementType`, and `stylers` properties determining specific modifications."],["Utilize the Maps Platform Styling Wizard to quickly generate JSON styling objects, simplifying the process of creating custom map styles."],["Apply styles to the default map by setting the `styles` property in the `MapOptions` object during map creation or by using the `Map.setOptions` method."],["Create styled map types by setting the style array to a `StyledMapType` object, enabling the addition of custom map styles without impacting the default map types."]]],["Custom styling for maps can be applied via embedded JSON style declarations to default maps or user-switchable map types. Create an array of `MapTypeStyle` objects specifying `featureType`, `elementType`, and `stylers` to define styling. For consistent styling across apps, use cloud customization with a map ID. Use the Maps Platform Styling Wizard to quickly generate JSON styling or apply styles by setting the map's `styles` property within the `MapOptions` object or the `Map.setOptions` method.\n"]]