当前位置:网站首页>Cesium knows the longitude and latitude of one point and the distance to find the longitude and latitude of another point
Cesium knows the longitude and latitude of one point and the distance to find the longitude and latitude of another point
2022-07-07 14:04:00 【The most ferocious little seal】
The whole article refers to :GIS Algorithm – Know a little latitude and longitude , azimuth , Find another point from distance
The algorithm used by the great God :
Great circle algorithm :http://www.movable-type.co.uk/scripts/latlong.html
Usage method : Direct value transfer , What you return is the longitude and latitude of another point .
explain : Elevation is not considered in this method .
/** * * @param {*} lon longitude * @param {*} lat latitude * @param {*} angle angle (0~360 degree ) * @param {*} distance distance ( rice ) * */
function get_another_point(lon, lat, angle, distance) {
// WGS84 Coordinate system
var a = 6378137; // Equatorial radius
var b = 6356752.3142; // Short radius
var f = 1 / 298.257223563; // Oblateness
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) };
}
边栏推荐
- 使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
- MySQL error 28 and solution
- Redis 核心数据结构 & Redis 6 新特性详
- Navicat run SQL file import data incomplete or import failed
- 請問,在使用flink sql sink數據到kafka的時候出現執行成功,但是kafka裏面沒有數
- 3D Detection: 3D Box和点云 快速可视化
- How does MySQL control the number of replace?
- 社会责任·价值共创,中关村网络安全与信息化产业联盟对话网信企业家海泰方圆董事长姜海舟先生
- PC端页面如何调用QQ进行在线聊天?
- Leecode3. Longest substring without repeated characters
猜你喜欢

"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?

Build a secure and trusted computing platform based on Kunpeng's native security

Details of redis core data structure & new features of redis 6
![Supply chain supply and demand estimation - [time series]](/img/2c/82d118cfbcef4498998298dd3844b1.png)
Supply chain supply and demand estimation - [time series]

2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天

高等數學---第八章多元函數微分學1

"New red flag Cup" desktop application creativity competition 2022

实现IP地址归属地显示功能、号码归属地查询

2022-7-6 Leetcode 977. Square of ordered array

Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
随机推荐
2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
手把手教会:XML建模
Environment configuration of lavarel env
【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
请问,我kafka 3个分区,flinksql 任务中 写了 join操作,,我怎么单独给join
参数关键字Final,Flags,Internal,映射关键字Internal
How does MySQL control the number of replace?
TPG x AIDU | AI leading talent recruitment plan in progress!
Clickhouse (03) how to install and deploy Clickhouse
AI人才培育新思路,这场直播有你关心的
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Move base parameter analysis and experience summary
[daily training] 648 Word replacement
2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置
Cesium 已知一点经纬度和距离求另一个点的经纬度
FCOS3D label assignment
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
Use day JS let time (displayed as minutes, hours, days, months, and so on)
Laravel5 call to undefined function OpenSSL cipher IV length() error php7 failed to open OpenSSL extension
docker部署oracle