在离子型LaunchNavigator.navigate中使用坐标代替城市文本

时间:2018-09-21 13:49:10

标签: android ios ionic-framework

我正在尝试从离子应用程序中加载导航器应用程序以显示路线,并且我正在使用Google地图,但问题是我正在使用仅接受字符串-位置名称的launchNavigator函数。 / p>

navigateLocation(){
    let options: LaunchNavigatorOptions = {
        start:[this.latitude,this.longitude],
        app: this.launchNavigator.APP.GOOGLE_MAPS
    };
    this.launchNavigator.navigate('Lagos, ON', options)  //here
    .then(success =>{
        console.log(success);
    },error=>{
        console.log(error);
    })
}

因此,拉各斯选项可以是伦敦,也可以是其他任何城市,但是如果我要获取偏远地点或其他城市,该怎么办。 为什么我不能只使用经度和纬度,而不是名称。 例如

this.launchNavigator.navigate({lat:8.234345, lng:7:5644563}, 'ON', options);

类似的东西。...

我不知道以前是否有人这样做,请帮助。 谢谢。

1 个答案:

答案 0 :(得分:1)

我这样用  let destination = [lat, lng]; this.launchNavigator.navigate(destination) .then( success => console.log('Launched navigator'), error => console.log('Error launching navigator', error) );

它告诉我如何从我所在的位置到经过的坐标。

相关问题