We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App
ios 18 & Android 13, 低版本应该也一样
macOS
CLI命令行
HBuilderX@4.24、uniapp@3.0.0-4010520240507001
打开谷歌地图后显示的地址为 谷歌地图根据 传入name 搜索出的距离较近的推荐结果,而非传入经纬度的对应地址
uni.openLocation({ latitude: 47.6319608, longitude: -122.1370117, name: "Tian Tian Noodle", address: "15230 NE 24th St, Redmond, WA 98052" });
导航到目标经纬度对应地址
导航到了name搜索到的推荐地址
app内预览的地址是正确的
打开谷歌地图后的导航地址错误
The text was updated successfully, but these errors were encountered:
看了下目前的源码,打开谷歌地图时会传入 daddr 和 sll,daddr 传入的是 encodeURIComponent(name), sll 传入的是 encodeURIComponent(latitude + "," + longitude)) , 但是实际上 daddr 为路线搜索的终点(可以是纬度、经度或查询格式的地址。如果查询字符串返回多个结果,系统会选择第一个结果),sll 只是提供搜索的推荐中心点,因此这里 daddr 应该设置为 经纬度格式 或者 详细地址
相关源码 谷歌地图文档
Sorry, something went wrong.
目前我的处理方式:
getUrl: () => { if (isAndroid) return `https://www.google.com/maps/?daddr=${latLng}+(${name})`; return `comgooglemapsurl://maps.google.com/?daddr=${latLng}+(${name})`; }
有相同问题的可以参考,不足之处在于+(${name})在安卓上打开谷歌地图后会被通过经纬度查询到的详细地址覆盖掉,在ios上则表现良好
No branches or pull requests
发行方式
App
具体平台
ios 18 & Android 13, 低版本应该也一样
开发环境
macOS
项目创建方式
CLI命令行
依赖版本
HBuilderX@4.24、uniapp@3.0.0-4010520240507001
问题描述
打开谷歌地图后显示的地址为 谷歌地图根据 传入name 搜索出的距离较近的推荐结果,而非传入经纬度的对应地址
重现步骤
期望行为
导航到目标经纬度对应地址
实际行为
导航到了name搜索到的推荐地址
截图或录屏
app内预览的地址是正确的

打开谷歌地图后的导航地址错误

The text was updated successfully, but these errors were encountered: