angular - 如何从角度中的地址获取经度和纬度 - 离子4
问题描述
我在 ionic 4 上构建了以下代码。它适用于 Andriod 设备,但不适用于 IOS。
我发现要让 IOS 工作,我需要计算出经度和纬度并将其传递进去。
我尝试了一个测试并硬编码了经度和纬度,它可以在 IOS 设备上运行。
但是,我需要一种从某个位置获取经度和纬度的方法。
我已经看到了地理位置,但这并没有通过一个位置。
this.geolocation.getCurrentPosition()
this.geolocation.watchPosition()
这是我的代码,如何从该位置获取经度和纬度?
location = '10 Downing St, Westminster, London'
GoToUrl(location) {
if (this.platform.is('android')) {
window.location.href = 'geo:' + '?q=' + location;
}
else {
const destination = '51.503391' + ',' + '-0.127630';
window.open('maps://?q=' + destination + '_system');
}
}
}
解决方案
推荐阅读
- python - 如何使用键盘启动 python 代码
- flutter - 按下返回按钮时,在颤动中处理后使用了 Videoplayercontroller 的错误
- android - 我一直在尝试在 kotlin 中使用 For Loop 来遍历这个 JsonObject
- android - 如何从 PagingData 获取数据
对象到达 ViewHolder 之前? - reactjs - 为什么导入到 react jsx 文件的函数返回“对象不是函数错误消息”?
- c# - 如何避免看似自动引用“父”命名空间?
- github - 将 master 变基到上游
- parsing - Logstash grok - Apache 访问日志
- wordpress - 如何使用 WordPress、Elementor pro 创建客户端门户?
- java - 在 android 11 及更低版本中设置灯光状态栏的代码 android 11 弃用警告不会发生