我正在使用谷歌地圖角度組件,它工作得很好!但是現(xiàn)在我想從地圖上移除一些地標(biāo)以減少它的擁堵,以便能夠更清楚地顯示我的標(biāo)記。我在下面找到了這些資源,但不知道如何將其應(yīng)用于我正在使用的 <google-map> 節(jié)點(diǎn)包。創(chuàng)建 json 以在地圖上隱藏地標(biāo)和其他功能的站點(diǎn)顯示如何從谷歌地圖開發(fā)網(wǎng)站隱藏地圖功能描述相同問題的 SO 鏈接我在這個(gè)谷歌文檔中看到它顯示了使用'setMapStyle()'將樣式應(yīng)用于'googlemap',但這不是角度包中的方法下面是我使用谷歌地圖的組件(不是所有代碼),但它顯示了我如何使用地圖的所有代碼import { MapInfoWindow, MapMarker, GoogleMap} from '@angular/google-maps';export class YogabandEventsComponent implements OnInit { colContentRef: ElementRef; @ViewChild(GoogleMap, { static: false }) googleMap: GoogleMap; @ViewChild(MapInfoWindow, { static: false }) infoWindow: MapInfoWindow; zoom = 12; center: google.maps.LatLngLiteral; options: google.maps.MapOptions = { mapTypeId: 'roadmap', mapTypeControl: false, scrollwheel: true, maxZoom: 18, minZoom: 10, streetViewControl: false, fullscreenControl: false }; markers: Marker[]; infoContent = ''; constructor(...) { ... } openInfo(marker: MapMarker, content) { this.infoContent = content; this.infoWindow.open(marker); } showMarkers() { this.markers = []; for (const ybEvent of this.yogabandEvents) { const marker = new Marker(); marker.info = ybEvent.name; marker.title = ybEvent.name; marker.position = { lat: ybEvent.latitude, lng: ybEvent.longitude }; marker.label = { color: '#17a2b8', text: ybEvent.yogaType, fontWeight: 'bold', fontSize: '16px' }; marker.options = { icon: { // scaledSize: new google.maps.Size(40, 40), url: 'assets/images/marker.svg', labelOrigin: new google.maps.Point(18, 50) } }; this.markers.push(marker); } }
如何使用谷歌地圖角度組件從谷歌地圖中刪除地標(biāo)
MMMHUHU
2022-11-11 14:44:25