Meine letzte Arbeitslösung. Aber ich verstehe immer noch nicht wo und wie MapTypeStyle Interface verwendet wird.
html Hinzufügen [styles]="customStyle"
<sebm-google-map [latitude]="lat" [longitude]="lng" [styles]="customStyle" >
<sebm-google-map-marker [latitude]="lat" [longitude]="lng" ></sebm-google-map-marker>
</sebm-google-map>
Komponente (Auszug) Zugabe public customStyle = [{ "JSON style declaration goes here" }]
export class GmapComponent implements OnInit {
public customStyle = [
{
"elementType": "geometry",
"stylers": [
{
"hue": "#ff4400"
},
{
"saturation": -100
},
{
"lightness": -4
},
{
"gamma": 0.72
}
]
},
{
"featureType": "road",
"elementType": "labels.icon"
},
{
"featureType": "landscape.man_made",
"elementType": "geometry",
"stylers": [
{
"hue": "#0077ff"
},
{
"gamma": 3.1
}
]
},
{
"featureType": "water",
"stylers": [
{
"hue": "#00ccff"
},
{
"gamma": 0.44
},
{
"saturation": -33
}
]
},
{
"featureType": "poi.park",
"stylers": [
{
"hue": "#44ff00"
},
{
"saturation": -23
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"hue": "#007fff"
},
{
"gamma": 0.77
},
{
"saturation": 65
},
{
"lightness": 99
}
]
},
{
"featureType": "water",
"elementType": "labels.text.stroke",
"stylers": [
{
"gamma": 0.11
},
{
"weight": 5.6
},
{
"saturation": 99
},
{
"hue": "#0091ff"
},
{
"lightness": -86
}
]
},
{
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [
{
"lightness": -48
},
{
"hue": "#ff5e00"
},
{
"gamma": 1.2
},
{
"saturation": -23
}
]
},
{
"featureType": "transit",
"elementType": "labels.text.stroke",
"stylers": [
{
"saturation": -64
},
{
"hue": "#ff9100"
},
{
"lightness": 16
},
{
"gamma": 0.47
},
{
"weight": 2.7
}
]
}
];
title: string = 'Current Location';
lat: number = 50.937531;
lng: number = 6.960278600000038;
constructor() {
}
ngOnInit() {
}
}
Was sind die Stile, die Sie anwenden möchten? Der [Erste Schritte] (https://angular-maps.com/docs/getting-started.html) sagt nur, um 'styleUrls: ['app.component.css']' in der Komponentendeklaration zu verwenden. Ihr Beispiel enthält keine Details zu dem Stil, den Sie anwenden möchten. – Adam
in den Komponenten css Ich füge nur Stile zur Komponente selbst, wie Breite und Höhe der Karte. Was ich erreichen möchte, ist die Verwendung des JASON formatierten Stils, zum Beispiel https://mapstyle.withgoogle.com/ und von meinem Standpunkt aus muss dies über die API (?) –