MarkerOptions interface
September 29, 2018 ยท View on GitHub
let options: MarkerOptions = {
icon: {
url: 'assets/marker_icon.png',
size: {
width: 32,
height: 24
}
},
title: 'Hello World'
snippet: '@ionic-native/google-maps'
position: {lat: ..., lng: ...},
infoWindowAnchor: [16, 0],
anchor: [16, 32],
draggable: true,
flat: false,
rotation: 32,
visible: true,
styles: {
'text-align': 'center',
'font-style': 'italic',
'font-weight': 'bold',
'color': 'red'
},
animation: GoogleMapsAnimation.DROP,
zIndex: 0,
disableAutoPan: true
};
this.map.addMarker(options).then((marker: Marker) => {
marker.showInfoWindow();
});
Interface members
| Params | Type | Details |
|---|---|---|
| position | ILatLng | marker position |
| icon | string | MarkerIcon | (optional)The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64. Please check out the MarkerIcon page. |
| title | string | (optional)The content of the infoWindow. If you use HtmlInfoWindow, you can not set this property. |
| snippet | string | (optional)The snippet of the infoWindow. If you use HtmlInfoWindow, you can not set this property. |
| infoWindowAnchor | [x: number, y: number] | (optional)Specify the anchor of the InfoWindow in pixels |
| anchor | [x: number, y: number] | (optional)Specify the anchor of icon image in pixels |
| draggable | boolean | (optional)Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker. |
| flat | boolean | (optional)Set true if you want to use a flat marker. (Default: false) |
| rotation | number | (optional)Set rotation angle. (Default: 0) |
| visible | boolean | (optional)Set false if you want to hide. (Default: true) |
| styles | { 'text-align': (left, center, right), 'font-style': (normal, italic), 'font-weight': (normal, bold), 'color': (red, #ccffcc, rgb(90, 32 100), etc) } |
(optional)Specify the options for title. This property work for normal InfoWindow. |
| animation | string | (optional)Which animation to play when marker is added to a map. |
| zIndex | number | (optional)Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. |
| disableAutoPan | boolean | (optional)Set to true to disable auto panning when the marker is clicked. |