打开地图以在 Nativescript 中显示从当前位置到应用程序的方向
Open map to show direction from current location from application in Nativescript
我只有一个标记的坐标。
当我有 Link 条路线时,我想打开 google 地图。
所以,我在 html 中有这段代码:
<Button (tap)="raggiungi()">RAGGIUNGI</Button >
在ts中我有这个功能:
raggiungi() {
let lat = 53.9187068;
let lng = 27.5862874;
let url = 'https://maps.google.com/' + '?' + 'daddr' + '=' + lat +','+ lng
console.log(url)
}
在控制台中显示此 url:https://maps.google.com/?daddr=53.9187068,27.5862874
现在,当我有这个 link 时,如何使用这个坐标打开地图应用程序?
使用openUrl方法
utilsModule.openUrl(YourUrl)
我只有一个标记的坐标。
当我有 Link 条路线时,我想打开 google 地图。
所以,我在 html 中有这段代码:
<Button (tap)="raggiungi()">RAGGIUNGI</Button >
在ts中我有这个功能:
raggiungi() {
let lat = 53.9187068;
let lng = 27.5862874;
let url = 'https://maps.google.com/' + '?' + 'daddr' + '=' + lat +','+ lng
console.log(url)
}
在控制台中显示此 url:https://maps.google.com/?daddr=53.9187068,27.5862874
现在,当我有这个 link 时,如何使用这个坐标打开地图应用程序?
使用openUrl方法
utilsModule.openUrl(YourUrl)