当前位置:网站首页>Convert longitude and latitude to distance
Convert longitude and latitude to distance
2022-06-21 17:36:00 【Xuanyuan】
private Double get_distanse(locate a,locate b){
Double result=0.00;
Double ra=6378140.0;
Double rb=6356755.0;
Double lat_a=Math.toRadians(a.getLatitude());
Double lat_b=Math.toRadians(b.getLatitude());
Double lon_a=Math.toRadians(a.getLongitude());
Double lon_b=Math.toRadians(b.getLongitude());
double pa = Math.atan(rb / ra * Math.tan(lat_a));
double pb = Math.atan(rb / ra * Math.tan(lat_b));
double x = Math.acos(Math.sin(pa) * Math.sin(pb) + Math.cos(pa) * Math.cos(pb) * Math.cos(lon_a - lon_b));
double c1 = (Math.sin(x) - x) * Math.pow((Math.sin(pa) + Math.cos(pb)), 2) / Math.pow(Math.cos(x / 2), 2);
double c2 = (Math.sin(x) - x) * Math.pow((Math.sin(pa) - Math.cos(pb)), 2) / Math.pow(Math.cos(x / 2), 2);
double flatten = (ra - rb) / ra;
double dr = flatten / 8 * (c1 - c2);
result=ra*(x+dr);
result=result/1000;
return result;
}
边栏推荐
- Stack growth direction and memory growth direction
- Not this year's 618?
- IEC62133与EN62133有何区别?主要测试哪些项目?
- BM23 二叉树的前序遍历
- I am about to enter my senior year and begin my most sincere confession
- [MySQL learning notes 14] DQL statement execution sequence
- FragmentStatePagerAdapter 与FragmentPagerAdapter的区别
- Why did you win the first Taosi culture award of 20000 RMB if you are neither a top R & D expert nor a sales bull?
- Variables and pointers
- Lagrange interpolation
猜你喜欢

软件测试体系学习及构建(14)-测试基础之软件测试和开发模型概述

Jetpack Compose 的阶段

Niuke.com: large number addition

硅橡胶玻纤管EN45545防火试验的难易程度

【mysql学习笔记15】用户管理

《MATLAB 神经网络43个案例分析》:第27章 LVQ神经网络的预测——人脸朝向识别

《MATLAB 神经网络43个案例分析》:第26章 LVQ神经网络的分类——乳腺肿瘤诊断

Vector data download for mainland and global epidemic data, based on geo JSON to SHP

Accelerate the implementation of cloud native applications, and Yanrong yrcloudfile and Tianyi cloud have completed the Compatibility Certification

shamir
随机推荐
Qt5 knowledge: string list qstringlistmodel
Oracle JDBC Driver
Fragment and activity value transfer
Simple ideas and procedures for quick sorting
SCAU软件工程基础
JetPack compose 状态提升(二)
经纬度转换为距离
【mysql学习笔记13】查询语句综合练习
List set map in kotlin
常见设置模式
Common formula of derivative__ Common formulas of indefinite integral
Android kotlin class delegation by, by lazy key
算法--按奇偶性交换后的最大数字(Kotlin)
Function call model
module. Exports points to problems
3M mutual aid intelligent contract system development and construction technology
Matlab中xticks函数
Stack growth direction and memory growth direction
Kotlin annotation declaration and use
Kotlin DSL构建