# GreatCircle.jl
using Leaflet, Blink, Geodesics, GeometryBasics, Statistics, TileProviders
# 1) Endpoints
lon1, lat1 = -118.243683, 34.052235 # Los Angeles
lon2, lat2 = 139.839478, 35.652832 # Tokyo
# 2) WGS84 ellipsoid
a, f = Geodesics.EARTH_R_MAJOR_WGS84, Geodesics.F_WGS84
# 3) Inverse solve
dist, az, baz = Geodesics.inverse(
deg2rad(lon1), deg2rad(lat1),
deg2rad(lon2), deg2rad(lat2),
a, f,
)
# 4) Sample waypoints
N = 100
s_vals = range(0, stop=dist, length=N)
pts_rad = [ Geodesics.forward(deg2rad(lon1), deg2rad(lat1), az, s, a, f)
for s in s_vals ]
coords = [(rad2deg(lon), rad2deg(lat)) for (lon, lat, _) in pts_rad]
# 5) Make a LineString
points = [ Point(pt) for pt in coords ]
route = LineString(points)
# 6) Layer + Provider
layer = Leaflet.Layer(route; color="red", border_width=3.0)
provider = Providers.Google() # ← Correct provider call :contentReference[oaicite:1]{index=1}
# 7) Build & show map
center = [ mean([lat1, lat2]), mean([lon1, lon2]) ]
m = Leaflet.Map(; provider, layers=[layer], center=center, zoom=3, height=600)
w = Blink.Window()
body!(w, m)
Discussion about this post
No posts
Very cool!
But might I suggest using the code block for code. It preserves whitespace and doesn't turn every line into its own paragraph. When writing/editing a post, use the [More ▼] widget in the upper right and select [Code Block].
Where is your antipode located?