Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
  • 1.  Calculating distance between 2 Lat Long coordinates

    Posted Tue May 25, 2021 10:16 PM
    Edited by System Admin Fri January 20, 2023 04:16 PM
    Hi,

    I am sure this has been discussed previously, but I cannot seem to find anything.

    We have 11.1.7 installed, I am wondering is there is a way to calculate the distance (as the crow flies) between 2 GPS locations within Cognos ?

    Thanks in advance,


    ------------------------------
    Chris Adams
    ------------------------------
    #CognosAnalyticswithWatson


  • 2.  RE: Calculating distance between 2 Lat Long coordinates

    Posted Thu May 27, 2021 10:21 AM
    I found this:

    http://www.m0nwk.co.uk/how-to-calculate-distance-between-two-points-using-latitude-and-longitude/

    ------------------------------
    RB
    https://github.com/CognosExt
    ------------------------------



  • 3.  RE: Calculating distance between 2 Lat Long coordinates

    Posted Fri May 28, 2021 03:18 PM

    Several databases will offer you some GIS functions, hence look at those.

    If you want to compute using SQL expressions, if your system has the trig functions.

    The distance between lat and long points can be derived using the Haversine formula

    DEGREES(ACOS(COS(RADIANS(lat1)) * COS(RADIANS(lat2)) * COS(RADIANS(long1) - RADIANS(long2)) + SIN(RADIANS(lat1)) * SIN(RADIANS(lat2))))

    Multiplying value by constant to change units

    • Kilometers = 111.045
    • Meters = 111045.0
    • Miles = 69.0




    ------------------------------
    NIGEL CAMPBELL
    ------------------------------