得到两缘点之间的距离

编程入门 行业动态 更新时间:2024-10-27 03:29:09
本文介绍了得到两缘点之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要作出这样的检查有什么从用户是最近的地方应用程序。我可以很容易地获取用户的位置和我有随纬度和经度的地方的清单。

什么是知道对当前位置的名单最近的地方的最佳方式。

我找不到在谷歌API的任何东西。

我很担心,我需要求助于我的计算和必须做数学计算的呢。

你们有什么感想?

欢呼和感谢阅读或回复。

解决方案

位置LOC1 =新的位置(); loc1.setLatitude(LAT1); loc1.setLongitude(lon1); 位置LOC2 =新的位置(); loc2.setLatitude(LAT2); loc2.setLongitude(lon2); 浮distanceInMeters = loc1.distanceTo(LOC2);

参考:developer.android/reference/android/location/Location.html#distanceTo(android.location.Location)

I want to make a apps that check what's the nearest place from where the user is. I can easily get the location of the user and I have a list of places with latitude and longitude.

What would be the best way to know the nearest place of the list against the current position.

I could not find anything in the google APIs.

I am worried I need to resort to my calculate and have to do math to calculate it.

What do you guys think ?

Cheers and thanks for reading or replying.

解决方案

Location loc1 = new Location(""); loc1.setLatitude(lat1); loc1.setLongitude(lon1); Location loc2 = new Location(""); loc2.setLatitude(lat2); loc2.setLongitude(lon2); float distanceInMeters = loc1.distanceTo(loc2);

Reference: developer.android/reference/android/location/Location.html#distanceTo(android.location.Location)

更多推荐

得到两缘点之间的距离

本文发布于:2023-10-27 22:35:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:距离   两缘点

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!