gpt4 book ai didi

android - 如何获得两个gps地址之间的差异

转载 作者:行者123 更新时间:2023-11-29 18:19:16 26 4
gpt4 key购买 nike

我有两个经度和纬度值。即,

longitude1latitude1 来自网络服务

longitude2latitude2 是我的设备值。

所以我想计算这两个地址之间的差异。所以我尝试了下面的代码

private Geocoder geocoder;

geocoder=new Geocoder(this);

Address address1=geocoder.getFromLocation(latitude1,longitude1,1).get(0);

Address address2=geocoder.getFromLocation(latitude2,longitude2,1).get(0);

所以我想知道地址 1 和地址 2 之间的区别。所以请告诉我如何找出address1address2之间的区别。

提前致谢。

最好的问候

最佳答案

使用下面的方法
Location.distanceBetween (double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] 结果);

因此结果[0] 具有两个位置之间以米为单位的近似距离。

关于android - 如何获得两个gps地址之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6426487/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com