Gaya visual peta baru akan segera tersedia di Google Maps Platform. Perubahan pada gaya visual peta ini mencakup palet warna default baru dan peningkatan pada pengalaman dan kegunaan peta. Semua gaya peta akan otomatis diperbarui pada Maret 2025. Untuk mengetahui informasi selengkapnya tentang ketersediaan dan cara ikut menggunakan versi terbaru ini lebih awal, lihat artikel Gaya peta baru untuk Google Maps Platform.
Untuk menata gaya isian dan goresan untuk poligon batas, gunakan penutupan gaya visual yang menerima GMSPlaceFeature dan menampilkan GMSFeatureStyle untuk menentukan atribut gaya. Kemudian, tetapkan
properti gaya ke penutupan gaya, yang berisi logika gaya visual.
Swift
letmapView=GMSMapView(frame:.zero,mapID:GMSMapID(identifier:"YOUR_MAP_ID"),camera:GMSCameraPosition(latitude:20.773,longitude:-156.01,zoom:12))letlayer=mapView.featureLayer(of:.locality)// Define a style with purpleletstyle=FeatureStyle(fill:.purple.withAlphaComponent(0.5),stroke:.purple,strokeWidth:3.0)// Apply the style to a single boundary.layer.style={($0.placeID=="ChIJ0zQtYiWsVHkRk8lRoB1RNPo"/* Hana, HI */)?style:nil}
Objective-C
GMSMapView*mapView=[GMSMapViewmapWithFrame:CGRectZeromapID:[GMSMapIDmapIDWithIdentifier:@"MAP_ID"]camera:[GMSCameraPositioncameraWithLatitude:20.773longitude:-156.01zoom:12]];GMSFeatureLayer<GMSPlaceFeature*>*layer=[mapViewfeatureLayerOfFeatureType:GMSFeatureTypeLocality];// Define a style with purple fill and border.GMSFeatureStyle*style=[GMSFeatureStylestyleWithFillColor:[[UIColorpurpleColor]colorWithAlphaComponent:0.5]strokeColor:[UIColorpurpleColor]strokeWidth:3.0];// Apply the style to a single boundary.layer.style=^(GMSPlaceFeature*feature){return[feature.placeIDisEqual:@"ChIJ0zQtYiWsVHkRk8lRoB1RNPo"/* Hana, HI */]?style:nil;};
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2024-12-18 UTC."],[[["This documentation explains how to style the fill and stroke of boundary polygons using a styling closure that takes a `GMSPlaceFeature` and returns a `GMSFeatureStyle`."],["The styling closure defines the style attributes for the polygon, such as fill color, stroke color, and stroke width."],["Styling Places data might require integrating the Places SDK for iOS, although it's not always mandatory."],["Code examples in Swift and Objective-C demonstrate how to apply a purple style to a specific boundary polygon using its place ID."]]],[]]