What are the commonly used calculation formulas on the earth in big data's development?
Editor to share with you what are the commonly used calculation formulas on the earth in the development of big data. I hope you will gain something after reading this article. Let's discuss it together.
The website is http://www.movable-type.co.uk/scripts/latlong.html
Some common calculations are done according to longitude and latitude, and there is sample code for JavaScript.
Please watch the introduction website in English patiently.
Haversine formula to calculate the distance according to the longitude and latitude of two points
Spherical Law of Cosines cosine sphere law
Calculate the location of the center point of two points
Given a point and distance, threshold, calculate the location of another point on the earth
Whether the two lines on the earth intersect
...
All have detailed formulas and sample code, such as:
Haversine
Formula:a = sin ²(Δ φ / 2) + cos φ 1 ⋅ cos φ 2 ⋅ sin ²(Δ λ / 2) c = 2 ⋅ atan2 (√ a, √ (1 − a)) d = R ⋅ cwhere φ is latitude, λ is longitude, R is earth's radius (mean radius = 6371km)
Note that angles need to be in radians to pass to trig functionsqualified JavaScript Var R = 6371e3; / / metresvar φ 1 = lat1.toRadians (); var φ 2 = lat2.toRadians (); var Δ φ = (lat2-lat1). ToRadians (); var delta λ = (lon2-lon1). ToRadians () Var a = Math.sin (delta φ / 2) * Math.sin (delta φ / 2) + Math.cos (φ 1) * Math.cos (φ 2) * Math.sin (Δ λ / 2) * Math.sin (Δ λ / 2); var c = 2 * Math.atan2 (Math.sqrt (a), Math.sqrt (1mera)); var d = R * c After reading this article, I believe you have a certain understanding of "what are the commonly used calculation formulas on earth in big data's development". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!