当前位置:网站首页>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) };
}
边栏推荐
- Oracle advanced (V) schema solution
- Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
- Show the mathematical formula in El table
- 2022-7-6 beginner redis (I) download, install and run redis under Linux
- 3D detection: fast visualization of 3D box and point cloud
- 2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
- 《厌女:日本的女性嫌恶》摘录
- 【日常训练】648. 单词替换
- 【AI实战】应用xgboost.XGBRegressor搭建空气质量预测模型(二)
- Laravel Form-builder使用
猜你喜欢
得物客服热线的演进之路
118. Yanghui triangle
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
LeetCode简单题分享(20)
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
2022-7-7 Leetcode 844. Compare strings with backspace
Flask session forged hctf admin
2022-7-6 beginner redis (I) download, install and run redis under Linux
566. Reshaping the matrix
Take you to master the three-tier architecture (recommended Collection)
随机推荐
3D detection: fast visualization of 3D box and point cloud
.net core 关于redis的pipeline以及事务
Vmware 与主机之间传输文件
flask session伪造之hctf admin
TPG x AIDU | AI leading talent recruitment plan in progress!
Laravel form builder uses
交付效率提升52倍,运营效率提升10倍,看《金融云原生技术实践案例汇编》(附下载)
3D Detection: 3D Box和点云 快速可视化
Thread pool reject policy best practices
2022-7-7 Leetcode 844. Compare strings with backspace
[untitled]
Huawei image address
call undefined function openssl_cipher_iv_length
Xshell connection server changes key login to password login
【堡垒机】云堡垒机和普通堡垒机的区别是什么?
Details of redis core data structure & new features of redis 6
2022-7-6 Leetcode 977.有序数组的平方
搜索框效果的实现【每日一题】
【日常训练】648. 单词替换
AI talent cultivation new ideas, this live broadcast has what you care about