We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


What’s the Distance Between Two Points? — Vertica Forum

What’s the Distance Between Two Points?

[Deleted User][Deleted User] Administrator
edited March 2018 in Tips from the Team

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!

Sign In or Register to comment.