Weather Observation Station 19

Sort by

recency

|

2366 Discussions

|

  • + 0 comments

    SQL Server Solution

    SELECT 
        CAST(
           SQRT(POWER(MIN(LAT_N) - MAX(LAT_N), 2) + POWER(MIN(LONG_W) - MAX(LONG_W), 2)) 
           AS DECIMAL(15,4)
        ) AS [Euclidean Distance]
    FROM STATION
    
  • + 0 comments

    After a lot of searching, I finally found the answer, because I had no idea that the Euclidean distance was the standard way to measure distance. Later, I got it and understood everything.

    SET @min_lat_n = (SELECT MIN(lat_n) FROM station); set @min_long_w = (select min(long_w) from station); set @Max_lat_n = (select max(lat_n) from station); set @max_long_w = (select max(long_w) from station);

    select round(sqrt(pow(@Max_lat_n - @min_lat_n, 2) + pow(@max_long_w - @min_long_w, 2)), 4) from station limit 1;

  • + 0 comments

    select round(sqrt(power(max(LAT_N)-min(LAT_N),2)+pow(max(LONG_W)-min(LONG_W),2)),4) from station; /* d≈ (Δx)^ 2+(Δy)^ 2

  • + 0 comments

    SELECT ROUND(SQRT(POWER(MAX(LAT_N)-MIN(LAT_N),2)+ POWER(MAX(LONG_W)-MIN(LONG_W),2)),4) FROM STATION

  • + 0 comments
    SELECT 
            ROUND(CAST(SQRT(
                POWER(MAX(LAT_N)-MIN(LAT_N), 2) + POWER(MAX(LONG_W)-MIN(LONG_W),2)
            )AS DECIMAL(10,4)),4)
         AS Dist
    FROM Station
    

    This code worked for me because if I am not using decimal it's taking value till multiple place and round is not working properly