当前位置:网站首页>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) };
}
边栏推荐
- Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
- Getting started with MySQL
- 《厌女:日本的女性嫌恶》摘录
- AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
- 648. Word replacement: the classic application of dictionary tree
- 实现IP地址归属地显示功能、号码归属地查询
- How does MySQL control the number of replace?
- Use of polarscatter function in MATLAB
- 华为镜像地址
- Attribute keywords aliases, calculated, cardinality, ClientName
猜你喜欢

docker部署oracle

Flask session forged hctf admin

2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array

Battle Atlas: 12 scenarios detailing the requirements for container safety construction

"New red flag Cup" desktop application creativity competition 2022

Detr introduction

Navicat run SQL file import data incomplete or import failed

Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)

2022-7-7 Leetcode 844. Compare strings with backspace

Show the mathematical formula in El table
随机推荐
118. 杨辉三角
TPG x AIDU | AI leading talent recruitment plan in progress!
. Net core about redis pipeline and transactions
mysql ”Invalid use of null value“ 解决方法
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
内存溢出和内存泄漏的区别
现在网上开户安全么?那么网上开户选哪个证券公司?
【日常训练--腾讯精选50】231. 2 的幂
Take you to master the three-tier architecture (recommended Collection)
AI talent cultivation new ideas, this live broadcast has what you care about
Use day JS let time (displayed as minutes, hours, days, months, and so on)
docker部署oracle
云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
FC连接数据库,一定要使用自定义域名才能在外面访问吗?
Getting started with MySQL
requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
Is the compass stock software reliable? Is it safe to trade stocks?
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]