【量算分析工具-方位角】GeoServer改造Springboot番外系列六

 【量算分析工具-概述】GeoServer改造Springboot番外系列三-CSDN博客

【量算分析工具-水平距离】GeoServer改造Springboot番外系列四-CSDN博客

【量算分析工具-水平面积】GeoServer改造Springboot番外系列五-CSDN博客

【量算分析工具-方位角】GeoServer改造Springboot番外系列六-CSDN博客

【量算分析工具-坡度】GeoServer改造Springboot番外系列七-CSDN博客

【量算分析工具-获取高程】GeoServer改造Springboot番外系列八-CSDN博客

【量算分析工具-贴地距离】GeoServer改造Springboot番外系列九-CSDN博客

【量算分析工具-贴地面积】GeoServer改造Springboot番外系列十-CSDN博客

方位角

从某点的指北方向线起,依 顺时针方向到目标方向线之间的水平夹角,叫方位角。

/**
     * 获取两点连线的方位角
     *
     * @param startLat
     * @param startLon
     * @param endLat
     * @param endLon
     * @return double
     */
    public static double getAzimuth(double startLon, double startLat, double endLon, double endLat) {
        double lat1 = Math.toRadians(startLat);
        double lat2 = Math.toRadians(endLat);
        double lon1 = Math.toRadians(startLon);
        double lon2 = Math.toRadians(endLon);

        double y = Math.sin(lon2 - lon1) * Math.cos(lat2);
        double x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);

        double azimuth = Math.atan2(y, x);
        azimuth = Math.toDegrees(azimuth); // 转换为角度
        azimuth = (azimuth + 360) % 360; // 转换为正值

        return azimuth; // 返回方位角和距离
    }

相关推荐

  1. GeoServer改造Springboot源码八(图层预览设计)

    2024-06-10 07:28:09       16 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-10 07:28:09       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-10 07:28:09       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-10 07:28:09       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-10 07:28:09       20 阅读

热门阅读

  1. conda常见命令

    2024-06-10 07:28:09       7 阅读
  2. Elasticsearch 详细介绍和经典应用

    2024-06-10 07:28:09       9 阅读
  3. 【数据结构】队列的应用(详解)

    2024-06-10 07:28:09       9 阅读
  4. 使用Spring Boot实现Redis多数据库缓存

    2024-06-10 07:28:09       12 阅读
  5. 小米测开面经

    2024-06-10 07:28:09       10 阅读
  6. 正态分布公式

    2024-06-10 07:28:09       8 阅读
  7. 使用 AES 算法在 C# 中实现安全字符串加密和解密

    2024-06-10 07:28:09       11 阅读
  8. 使用Spring Cloud设计电商系统架构

    2024-06-10 07:28:09       10 阅读
  9. Spring RestClient报错:400 Bad Request : [no body]

    2024-06-10 07:28:09       10 阅读