当前位置:网站首页>Cesium 已知一点经纬度和距离求另一个点的经纬度
Cesium 已知一点经纬度和距离求另一个点的经纬度
2022-07-07 11:59:00 【最凶残的小海豹】
整篇参考了:GIS算法–已知一点经纬度,方位角,距离求另一点
大神用的算法:
大圆算法:http://www.movable-type.co.uk/scripts/latlong.html
使用方法:直接传值,返回的就是另一个点的经纬度。
说明:本方法没有考虑高程问题。
/** * * @param {*} lon 经度 * @param {*} lat 纬度 * @param {*} angle 角度 (0~360度) * @param {*} distance 距离 (米) * */
function get_another_point(lon, lat, angle, distance) {
// WGS84坐标系
var a = 6378137; // 赤道半径
var b = 6356752.3142; // 短半径
var f = 1 / 298.257223563; // 扁率
var alpha1 = angle * (Math.PI / 180)
var sinAlpha1 = Math.sin(alpha1);
var cosAlpha1 = Math.cos(alpha1);
var tanU1 = (1 - f) * Math.tan(lat * (Math.PI / 180));
var cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
var sigma1 = Math.atan2(tanU1, cosAlpha1);
var sinAlpha = cosU1 * sinAlpha1;
var cosSqAlpha = 1 - sinAlpha * sinAlpha;
var uSq = cosSqAlpha * (a * a - b * b) / (b * b);
var A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
var B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
var sigma = distance / (b * A), sigmaP = 2 * Math.PI;
while (Math.abs(sigma - sigmaP) > 1e-12) {
var cos2SigmaM = Math.cos(2 * sigma1 + sigma);
var sinSigma = Math.sin(sigma);
var cosSigma = Math.cos(sigma);
var deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
sigmaP = sigma;
sigma = distance / (b * A) + deltaSigma;
}
var tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1;
var lat2 = Math.atan2(sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1,
(1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp));
var lambda = Math.atan2(sinSigma * sinAlpha1, cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1);
var C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha));
var L = lambda - (1 - C) * f * sinAlpha *
(sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
var revAz = Math.atan2(sinAlpha, -tmp); // final bearing
return {
lon: Number(lon) + L * (180 / Math.PI), lat: lat2 * (180 / Math.PI) };
}
边栏推荐
- 社会责任·价值共创,中关村网络安全与信息化产业联盟对话网信企业家海泰方圆董事长姜海舟先生
- What parameters need to be reconfigured to replace the new radar of ROS robot
- 10 pictures open the door of CPU cache consistency
- The difference between memory overflow and memory leak
- Redis 核心数据结构 & Redis 6 新特性详
- 接口自动化测试-接口间数据依赖问题解决
- 高等数学---第八章多元函数微分学1
- 《厌女:日本的女性嫌恶》摘录
- "Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
- Ways to improve the performance of raspberry pie
猜你喜欢
How far can it go to adopt a cow by selling the concept to the market?
AI talent cultivation new ideas, this live broadcast has what you care about
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Dry goods | summarize the linkage use of those vulnerability tools
Navicat运行sql文件导入数据不全或导入失败
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
. Net core about redis pipeline and transactions
AI人才培育新思路,这场直播有你关心的
Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
随机推荐
THINKPHP框架的优秀开源系统推荐
属性关键字Aliases,Calculated,Cardinality,ClientName
Flink | multi stream conversion
Vmware 与主机之间传输文件
call undefined function openssl_cipher_iv_length
使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
Laravel form builder uses
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
参数关键字Final,Flags,Internal,映射关键字Internal
Use of polarscatter function in MATLAB
Data refresh of recyclerview
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
648. Word replacement: the classic application of dictionary tree
AI talent cultivation new ideas, this live broadcast has what you care about
Milkdown control icon
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
搜索框效果的实现【每日一题】
Take you to master the three-tier architecture (recommended Collection)
SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1