博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
空间距离计算
阅读量:4597 次
发布时间:2019-06-09

本文共 994 字,大约阅读时间需要 3 分钟。

/**   *   * @param lat1     The y coordinate of the first point, in radians   * @param lon1     The x coordinate of the first point, in radians   * @param lat2     The y coordinate of the second point, in radians   * @param lon2     The x coordinate of the second point, in radians   * @return The distance between the two points, as determined by the Haversine formula, in radians.   */  public static double distHaversineRAD(double lat1, double lon1, double lat2, double lon2) {    //TODO investigate slightly different formula using asin() and min() http://www.movable-type.co.uk/scripts/gis-faq-5.1.html    // Check for same position    if (lat1 == lat2 && lon1 == lon2)      return 0.0;    double hsinX = Math.sin((lon1 - lon2) * 0.5);    double hsinY = Math.sin((lat1 - lat2) * 0.5);    double h = hsinY * hsinY +            (Math.cos(lat1) * Math.cos(lat2) * hsinX * hsinX);    return 2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h));  }

  

转载于:https://www.cnblogs.com/LBSer/p/3733550.html

你可能感兴趣的文章
spring的优缺点
查看>>
优云老王的心路历程(一):那个做了五年的产品经理
查看>>
双态运维分享之:业务场景驱动的服务型CMDB
查看>>
cocos2dx-3.6 触摸,键盘,聚焦事件
查看>>
JEECG中t:dictSelect的extendJson用法
查看>>
web开发下的各种下载方法
查看>>
第六章 堆排序 6.5 优先队列
查看>>
Linux搭建我的世界服务器
查看>>
数据库之范式
查看>>
译文 [ROM][多国语言][2015.06.11] Lenovo S750 (MTK6589) - andrea_d86-lenovos750-4.2.2
查看>>
租用游艇问题
查看>>
如何修改SharePoint 2010默认的任务通知邮件的格式?
查看>>
单用户模式下连接被占用定位spid
查看>>
Django JWT
查看>>
云推送注意(MSDN链接)
查看>>
条件编译解决AutoCAD多版本问题
查看>>
java的Integer与int的比较
查看>>
openstack安装文档
查看>>
正在改变世界的硅谷创业趋势
查看>>
No2_3.接口继承多态_Java学习笔记_多态
查看>>