Android:Location.distanceBetween 单位和模拟器未正确发送坐标

发布于 2024-08-22 17:19:45 字数 295 浏览 6 评论 0原文

大家好,我有两个问题

1)我一直无法找出Location.distanceBetween以哪些单位接收纬度和经度。是度还是微度?返回的距离单位是什么? 很抱歉这个菜鸟问题,但我在文档中找不到任何内容。

2) 在Windows XP 中使用Eclipse 3.3.2。模拟器无法正确发送坐标。无论是手动还是通过加载 gpx 文件,都不会调用 locationListener。我在 Ubuntu 中尝试过同样的代码并且工作正常。有人知道我该如何解决这个问题吗?办公室里没有安装linux,我可以带我的个人笔记本电脑。

非常感谢!

Hy everyone, I have two questions

1) I have not been able to find out in which units Location.distanceBetween receivs the latitude and longitude. Is it degrees or microdegrees? Whats the unit for the distance returned?
Sorry for this noob questions but I have not been able to find anything on the documentation.

2) In windows XP using Eclipse 3.3.2. Emulator does not send coordinates properly. Either it by hand or by loading a gpx file the locationListener is not invoked. This same code I have tried it in Ubuntu and works fine. Does someone know how can I solve this? In the office there is no linux installed and I can take my personal laptop.

Thanks a lot in advanced!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧时光的容颜 2024-08-29 17:19:45

1)来自android源:

public static void distanceBetween(double startLatitude, double startLongitude,
    double endLatitude, double endLongitude, float[] results) {
    if (results == null || results.length < 1) {
        throw new IllegalArgumentException("results is null or has length < 1");
    }
    computeDistanceAndBearing(startLatitude, startLongitude,
        endLatitude, endLongitude, results);
}

在computeDistanceAndBearing内部有评论说:

// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4)

我会检查那里

2)
转到:

  • 设置
  • 应用程序
  • 开发
  • 检查“允许模拟位置”是否已打开。

1) From android source:

public static void distanceBetween(double startLatitude, double startLongitude,
    double endLatitude, double endLongitude, float[] results) {
    if (results == null || results.length < 1) {
        throw new IllegalArgumentException("results is null or has length < 1");
    }
    computeDistanceAndBearing(startLatitude, startLongitude,
        endLatitude, endLongitude, results);
}

And inside computeDistanceAndBearing there is comment that says:

// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4)

I would check there

2)
Go to:

  • Settings
  • Applications
  • Development
  • Check if "Allow mock locations" is on.
说好的呢 2024-08-29 17:19:45

我遇到了模拟器无法从 ddms 获取位置的问题,结果是因为我有一个非英语语言环境,这似乎把它搞砸了。您可以尝试在 ddms 启动脚本中的 java 启动参数中添加“-Duser.language=en”,看看是否有帮助。该错误在此处

哦,我不知道纬度/经度的输入单位,但根据 api 文档,结果浮点数以米为单位。

I had problems with the emulator not getting locations from ddms and it turned out to be because I had an non-english locale which appears to screw it up. You can try adding "-Duser.language=en" to the start parameters for java in the ddms start script and see if it helps. The bug is here

Oh and I don't know the input units for lat/long but the resulting float is in metres according to the api docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文