Update public source
This commit is contained in:
@@ -20,6 +20,7 @@ from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import html
|
||||
import math
|
||||
import os
|
||||
|
||||
from datetime import datetime, timezone
|
||||
@@ -28,6 +29,22 @@ from zoneinfo import ZoneInfo
|
||||
|
||||
from .config import get_timezone
|
||||
|
||||
def haversine_m(lat1, lon1, lat2, lon2):
|
||||
radius = 6371000.0
|
||||
|
||||
phi1 = math.radians(lat1)
|
||||
phi2 = math.radians(lat2)
|
||||
dphi = math.radians(lat2 - lat1)
|
||||
dlambda = math.radians(lon2 - lon1)
|
||||
|
||||
a = (
|
||||
math.sin(dphi / 2.0) ** 2
|
||||
+ math.cos(phi1)
|
||||
* math.cos(phi2)
|
||||
* math.sin(dlambda / 2.0) ** 2
|
||||
)
|
||||
|
||||
return 2.0 * radius * math.asin(min(1.0, math.sqrt(a)))
|
||||
|
||||
# ============================================================
|
||||
# HTML
|
||||
|
||||
Reference in New Issue
Block a user