We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 18
Weather Observation Station 18
Sort by
recency
|
2475 Discussions
|
Please Login in order to post a comment
SELECT CAST((C+D) - (A+B) AS DECIMAL(10,4)) AS FCK FROM ( SELECT ROUND(MIN(LAT_N),4) AS A, ROUND(MIN(LONG_W),4) AS B, ROUND(MAX(LAT_N),4) AS C, ROUND(MAX(LONG_W),4) AS D FROM STATION) AS FCKING; =========================================259.6859=================
Consider and to be two points on a 2D plane.
happens to equal the minimum value in Northern Latitude (LAT_N in STATION). happens to equal the minimum value in Western Longitude (LONG_W in STATION). happens to equal the maximum value in Northern Latitude (LAT_N in STATION). happens to equal the maximum value in Western Longitude (LONG_W in STATION). Query the Manhattan Distance between points and and round it to a scale of decimal places.
The Manhattan Distance formula for two points (x1, y1) and (x2, y2) is: DManhattan = (x1−x2) + (y1−y2)
Applying this to points P1(a, b) and P2(c, d): DManhattan=(a−c) + (b−d)
SELECT ROUND(ABS((MIN(LAT_N) - MAX(LAT_N))) + ABS((MIN(LONG_W) - MAX(LONG_W))), 4) FROM station
N.B ABS() (absolute value) function, is crucial for Manhattan distance.
select round((max(long_w)-min(long_w))+(max(lat_n)-min(lat_n)),4) from station;
WITH tb AS ( SELECT MAX(LAT_N) AS c, MIN(LAT_N) AS a, MAX(LONG_W) AS d, MIN(LONG_W) AS b FROM STATION ) SELECT CAST(ROUND(ABS(a -c)+ABS(b - d),4) AS DECIMAL(10,4)) as Manhattan_Distance FROM tb;