What’s the Distance Between Two Points?
[Deleted User]
Administrator
Planning a road trip to Disney? How far is it? Vertica has a built-in function called DISTANCE that 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!
0