【发布时间】:2019-04-13 08:12:54
【问题描述】:
我有一个 Ionic 应用程序,它使用谷歌地图折线从数据 json api 获取飞行路线的纬度和经度。我尝试在折线的末端添加图标飞机
查看示例
但我只得到没有 icone 的折线。 l tried this doc from google map but he doesn't work
我的代码
loadMap() {
let AIR_PORTS = this.points;
console.log(AIR_PORTS)
this.map = GoogleMaps.create('map_canvas', {
camera: {
target: AIR_PORTS
}
});
let polyline: Polyline = this.map.addPolylineSync({
points: AIR_PORTS,
color: '#AA00FF',
width: 3,
geodesic: true,
clickable: true,
icon: {
scale: .5,
strokeWeight: 2,
strokeColor: 'green',
path: 'm 0,28.362183 10.996094,-28.63281288 4.082031,0 11.71875,28.63281288 -4.316406,0 -3.339844,-8.671875 -11.9726563,0 -3.1445312,8.671875 z m 8.2617188,-11.757813 9.7070312,0 -2.988281,-7.9296874 c -0.911473,-2.4088321 -1.588555,-4.3879967 -2.03125,-5.9375 -0.364596,1.8359613 -0.878919,3.6588762 -1.542969,5.46875 z'
},
fixedRotation: true,
offset: '0%'
});
polyline.on(GoogleMapsEvent.POLYLINE_CLICK).subscribe((params: any) => {
let position: LatLng = <LatLng>params[0];
let marker: Marker = this.map.addMarkerSync({
position: position,
title: position.toUrlValue(),
disableAutoPan: true
});
marker.showInfoWindow();
});
}
【问题讨论】:
标签: angular google-maps ionic4