GIS::D...ersine(3pm)

๐Ÿ“ฆ
version 0.20 ยท 6 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

โœจ 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 ๐Ÿซถ

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