5 Replies Latest reply on Feb 1, 2018 11:38 PM by Chris McClellan

    Nearest Location Finder for set of lat-longs

    Upasana Rai

      I am trying to find nearest location from given lat long.


      That’s determined by the Spherical Cosine Law, or the Haversine Formula which is mentioned below.



                   COS(RADIANS(long1) - RADIANS(long2)) +

                      SIN(RADIANS(lat1)) * SIN(RADIANS(lat2))))


      I have used this formula in SQL to determine distance between lat1-long1 and lat2-long2.


      lat1 and lat2 are the latitude and longitude which is in my table . The issue is this formula works only for one set of lat2- long2  but I want to implement this for a set of lat-long which is dynamic and is coming from the excel sheet. I am unable to blend or join the two sources as they don't have any common field.


      How can I do that ? Any ideas?