GIS::D...ersine(3pm)
โจ NAME โจ
GIS::Distance::Haversine โ exact spherical distance calculations. ๐ (yes bestie, that's the manual name, it's giving GIS::Distance::Haversine(3pm), and it's part of the User Contributed Perl Documentation collection ๐)
๐ DESCRIPTION ๐
Okay so this is the default distance calculation for GIS::Distance, and there's a reason for that: it keeps a good balance between speed and accuracy. Not too slow, not too sloppy. Main character energy fr fr. ๐
If you're the type who needs speed and you're cool with XS, there's a faster version of this exact same formula living at GIS::Distance::Fast::Haversine. Slay. ๐ฅ
Now, plot twist: normally you do NOT use this module directly. ๐ Instead you use GIS::Distance, which in turn interfaces with the various formula classes. So this lil guy is like, a supporting cast member, but an iconic one. ๐
๐งฎ FORMULA ๐งฎ
Here's the actual math, verbatim, no cap:
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c
Look at her go. ๐ Trigonometry ate and left no crumbs. ๐ฆ
๐ซถ SEE ALSO ๐ซถ
http://mathforum.org/library/drmath/view/51879.html๐ธhttp://www.faqs.org/faqs/geography/infosystems-faq/โญ
Go read them, bestie, they're literally right there. ๐
๐ฌ SUPPORT ๐ฌ
See "SUPPORT" in GIS::Distance. That's where the help lives, iykyk. ๐ซ
๐ AUTHORS ๐
See "AUTHORS" in GIS::Distance. Credit where credit is due, periodt. โจ
๐ LICENSE ๐
See "LICENSE" in GIS::Distance. Read it, respect it, love it. ๐
okay that's the whole page, and you understood all of it, I'm so proud of you ๐ฅน๐
Cute lil sign-off from the footer, since you deserve the receipts: this came from perl v5.36.0, dated 2023-10-21, and it's a page from User Contributed Perl Documentation. ๐ That's it, that's the vibe check. Byeee ๐ฆ
๐ฆ where this page comes from
- debian trixie: libgis-distance-perl 0.20-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgis-distance-perl 0.20-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgis-distance-perl 0.20-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgis-distance-perl 0.20-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms