Yeni harita stilleri yakında Google Haritalar Platformu'nda kullanıma sunulacak. Harita stilinde yapılan bu güncelleme, yeni bir varsayılan renk paletinin yanı sıra harita deneyimleri ve kullanılabilirliğiyle ilgili iyileştirmeler içermektedir. Tüm harita stilleri Mart 2025'te otomatik olarak güncellenecektir. Bu özelliğin kullanılabilirliği ve bu özelliğe daha önce nasıl katılacağınız hakkında daha fazla bilgi edinmek için Google Haritalar Platformu için yeni harita stili başlıklı makaleyi inceleyin.
Bir sınır poligonunun dolgusunu ve konturunu biçimlendirmek için GMSPlaceFeature kabul eden ve stil özelliklerini tanımlamak için GMSFeatureStyle döndüren bir stil kapatma kullanın. Ardından stil mülkünü, stil mantığını içeren bir stil kapatma işlevine ayarlayın.
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;};
[null,null,["Son güncelleme tarihi: 2025-01-14 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."]]],[]]