Vertica Quick Tip: What’s the Distance Between Two Points

Posted March 7, 2018 by Soniya Shah, Information Developer

This blog post was authored by Jim Knicely. Planning a road trip to Disney? How far is it? Vertica has a built-in function called DISTANCE, which returns the distance (in kilometers) between two points. You specify the latitude and longitude of both the starting point and the ending point. You can also specify the radius of curvature for greater accuracy when using an ellipsoidal model. Example: My wife wants us to drive from Pittsburgh, PA to Orlando, FL to visit Mickey Mouse. I think the drive would be too far! dbadmin=> SELECT DISTANCE(40.4406, -79.9959, 28.3852, -81.5639) Disney_is_this_far_from_home; Disney_is_this_far_from_home ------------------------------ 1348.12778743491 (1 row) I was able to convince my wife we should fly! Thanks, Vertica! Have Fun!