简体   繁体   English

位置感知Android,比较Java或数据库中的距离?

[英]location aware Android, comparing distance in java or database?

I have a question about geopoints guys.. 我有一个关于geopoints的问题。

I'm implementing a location-aware client-server application in android. 我在android中实现位置感知客户端服务器应用程序。 Clients have some saved locations in the server database (mysql). 客户端在服务器数据库(mysql)中具有一些保存的位置。 And they will get some messages bound to these locations. 他们将获得一些绑定到这些位置的消息。

I have to compare distance between 2 points, what is the best way to store and calculate the distance. 我必须比较两点之间的距离,什么是存储和计算距离的最佳方法。 Calculating the dinstance in the database with query, or geting all results into server java, and then calculate 2 points which is supplied by Location.distanceBetween(..). 通过查询计算数据库中的实例,或将所有结果获取到服务器java中,然后计算Location.distanceBetween(..)提供的2个点。

Which way is better, i'm a newbie in this. 哪种方法更好,我是这方面的新手。 Thank you.. 谢谢..

如果使用查询计算数据库中的距离,则应遍历数据库中的所有行...,并计算与该行中每个点的距离。或者如果将所有结果都输入到服务器中,然后计算之间的距离2分,那么您还应该遍历数据库的所有行并获取行中的值..然后计算距离..但在第二种情况下,您应该获取数据库中的所有值 (即位置值)...但是在第一种情况下,只有一个值 ...这是在第二种情况下应该做的额外工作..所以.. 第一种方法更好 ...我认为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM