From 971d027d8da6f15b4b72d74a7ef2b2f658a86c7d Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 7 Jan 2024 03:21:22 +0100 Subject: [PATCH] Better queries --- examples.js | 283 +++++++++++++++++++++++----------------------------- index.html | 9 +- 2 files changed, 131 insertions(+), 161 deletions(-) diff --git a/examples.js b/examples.js index d2bfc28..dfd469a 100644 --- a/examples.js +++ b/examples.js @@ -25,12 +25,12 @@ let queries = { greatest(0, least(avg(altitude), 50000)) / 50000 AS color3, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -54,8 +54,8 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, y * 1024 + x AS pos, count() AS total, - sum(desc LIKE 'BOEING%') AS boeing, - sum(desc LIKE 'AIRBUS%') AS airbus, + sum(desc LIKE 'BOEING%') AS blueoeing, + sum(desc LIKE 'AIRBUS%') AS alphairbus, sum(NOT (desc LIKE 'BOEING%' OR desc LIKE 'AIRBUS%')) AS other, greatest(1000000 DIV zoom_factor, total) AS max_total, @@ -65,12 +65,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, pow(total / max_total, 1/5) AS transparency, - 255 * (1 + transparency) / 2 AS a, - pow(boeing, 1/5) * 256 DIV (1 + pow(max_boeing, 1/5)) AS r, - pow(airbus, 1/5) * 256 DIV (1 + pow(max_airbus, 1/5)) AS g, - pow(other, 1/5) * 256 DIV (1 + pow(max_other, 1/5)) AS b + 255 * (1 + transparency) / 2 AS alpha, + pow(boeing, 1/5) * 256 DIV (1 + pow(max_boeing, 1/5)) AS red, + pow(airbus, 1/5) * 256 DIV (1 + pow(max_airbus, 1/5)) AS green, + pow(other, 1/5) * 256 DIV (1 + pow(max_other, 1/5)) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -101,12 +101,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 5000)) / 5000 AS color3, greatest(0, least(avg(ground_speed), 200)) / 200 AS color2, - 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'A7' AND ground_speed < 200 GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -134,48 +134,17 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, pow(total / max_total, 1/5) AS transparency, - 0 AS r, - 255 AS g, - 255 AS b, + 0 AS red, + 255 AS green, + 255 AS blue, - 255 * transparency AS a + 255 * transparency AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'A6' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, -"Supersonic": `WITH - bitShiftLeft(1::UInt64, {z:UInt8}) AS zoom_factor, - bitShiftLeft(1::UInt64, 32 - {z:UInt8}) AS tile_size, - - tile_size * {x:UInt16} AS tile_x_begin, - tile_size * ({x:UInt16} + 1) AS tile_x_end, - - tile_size * {y:UInt16} AS tile_y_begin, - tile_size * ({y:UInt16} + 1) AS tile_y_end, - - mercator_x >= tile_x_begin AND mercator_x < tile_x_end - AND mercator_y >= tile_y_begin AND mercator_y < tile_y_end AS in_tile, - - bitShiftRight(mercator_x - tile_x_begin, 32 - 10 - {z:UInt8}) AS x, - bitShiftRight(mercator_y - tile_y_begin, 32 - 10 - {z:UInt8}) AS y, - - y * 1024 + x AS pos, - - greatest(0, least(avg(altitude), 50000)) / 50000 AS color1, - (greatest(0, least(avg(ground_speed), 1000)) - 666) / 334 AS color2, - - 255 AS a, - color2 * 255 AS r, - color1 * 255 AS g, - least(1, count() / 10) * 255 AS b - -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 -FROM {table:Identifier} -WHERE in_tile AND ground_speed > 666 -GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, - "Light": `WITH bitShiftLeft(1::UInt64, {z:UInt8}) AS zoom_factor, bitShiftLeft(1::UInt64, 32 - {z:UInt8}) AS tile_size, @@ -201,12 +170,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color1, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 * transparency AS r, - 255 * color2 AS g, - 255 * color1 AS b, - 255 * (1/4 + 3/4 * transparency) AS a + 255 * transparency AS red, + 255 * color2 AS green, + 255 * color1 AS blue, + 255 * (1/4 + 3/4 * transparency) AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'A1' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -229,12 +198,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, y * 1024 + x AS pos, - least(255, 2 * greatest(r, g)) AS a, - 255 * least(1, avg(greatest(0, vertical_rate)) / 5000) AS g, - 255 * least(1, avg(least(0, vertical_rate)) / -5000) AS r, - 0 AS b + least(255, 2 * greatest(r, g)) AS alpha, + 255 * least(1, avg(greatest(0, vertical_rate)) / 5000) AS green, + 255 * least(1, avg(least(0, vertical_rate)) / -5000) AS red, + 0 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -257,12 +226,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, y * 1024 + x AS pos, - 255 * least(1, avg(abs(roll_angle)) / 10) AS a, - 255 * avg(max2(0, roll_angle)) / 21 AS r, - 255 * avg(min2(0, roll_angle)) / -21 AS g, - (1 - a) AS b + 255 * least(1, avg(abs(roll_angle)) / 10) AS alpha, + 255 * avg(max2(0, roll_angle)) / 21 AS red, + 255 * avg(min2(0, roll_angle)) / -21 AS green, + (1 - a) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -290,12 +259,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, pow(total / max_total, 1/5) AS transparency, - 255 * transparency AS a, - 255 * avg(year < 2000) AS r, - 255 * avg(year >= 2010) AS g, - a AS b + 255 * transparency AS alpha, + 255 * avg(year < 2000) AS red, + 255 * avg(year >= 2010) AS green, + a AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND year != 0 GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -326,12 +295,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color3, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND t = 'A388' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -357,12 +326,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color1, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 AS a, - 255 AS r, - color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + 255 AS red, + color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND t = 'IL76' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -392,12 +361,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color1, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - transparency * 255 AS a, - 255 AS r, - color1 * 255 AS g, - color2 * 255 AS b + transparency * 255 AS alpha, + 255 AS red, + color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND t = 'F16' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -428,12 +397,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color3, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} AS t WHERE in_tile AND aircraft_flight LIKE 'KLM%' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -463,14 +432,14 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 5000)) / 5000 AS color1, greatest(0, least(avg(ground_speed), 100)) / 100 AS color2, - 255 AS a, - transparency * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + transparency * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} AS t -WHERE in_tile AND t.r = 'N2163J' +WHERE in_tile AND r = 'N2163J' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, "Gliders": `WITH @@ -498,12 +467,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 5000)) / 5000 AS color1, greatest(0, least(avg(ground_speed), 100)) / 100 AS color2, - 255 * color2 AS b, - 255 * transparency * (color1 + color2) / 2 AS g, - 255 * (1 - color1) AS r, - 255 * (1 + transparency) / 2 AS a + 255 * color2 AS blue, + 255 * transparency * (color1 + color2) / 2 AS green, + 255 * (1 - color1) AS red, + 255 * (1 + transparency) / 2 AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'B1' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -533,12 +502,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 5000)) / 5000 AS color1, greatest(0, least(avg(ground_speed), 100)) / 100 AS color2, - 255 * color2 AS b, - 255 * transparency * (color1 + color2) / 2 AS g, - 255 * (1 - color1) AS r, - 255 * (1 + transparency) / 2 AS a + 255 * color2 AS blue, + 255 * transparency * (color1 + color2) / 2 AS green, + 255 * (1 - color1) AS red, + 255 * (1 + transparency) / 2 AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'B4' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -565,14 +534,14 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, min(offset) OVER () AS min_offset, max(offset) OVER () AS max_offset, - (1 + offset - min_offset) / (1 + max_offset - min_offset) AS rel_time, + (1 + offset - min_offset) / (1 + max_offset - min_offset) AS redel_time, - 255 AS a, - 255 * rel_time AS g, - 255 * (1 - rel_time) AS r, - 0 AS b + 255 AS alpha, + 255 * rel_time AS green, + 255 * (1 - rel_time) AS red, + 0 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -605,12 +574,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, c_weekend * 2.5 > c_weekday AS mostly_weekends, - 255 * transparency AS a, - 255 * c_weekend * mostly_weekends AS r, - r / 2 AS g, - 255 * c_weekday * (NOT mostly_weekends) AS b + 255 * transparency AS alpha, + 255 * c_weekend * mostly_weekends AS red, + r / 2 AS green, + 255 * c_weekday * (NOT mostly_weekends) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -634,16 +603,16 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, y * 1024 + x AS pos, count() AS total, - transform(t.r, ['N628TS', 'N272BG', 'N502SX', 'N140FJ'], [0xFF8888, 0x88FF88, 0xAAAAFF, 0xFFFF00], 0) AS color, + transform(r, ['N628TS', 'N272BG', 'N502SX', 'N140FJ'], [0xFF8888, 0x88FF88, 0xAAAAFF, 0xFFFF00], 0) AS color, - 255 AS a, - avg(color DIV 0x10000) AS r, - avg(color DIV 0x100 MOD 0x100) AS g, - avg(color MOD 0x100) AS b + 255 AS alpha, + avg(color DIV 0x10000) AS red, + avg(color DIV 0x100 MOD 0x100) AS green, + avg(color MOD 0x100) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} AS t -WHERE in_tile AND t.r IN ('N628TS', 'N272BG', 'N502SX', 'N140FJ') +WHERE in_tile AND r IN ('N628TS', 'N272BG', 'N502SX', 'N140FJ') GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, "Military": `WITH @@ -672,12 +641,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 50000)) / 50000 AS color3, greatest(0, least(avg(ground_speed), 700)) / 700 AS color2, - 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND dbFlags = 1 GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -708,12 +677,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 20000)) / 20000 AS color3, least(avg(abs(vertical_rate)), 10000) / 10000 AS color2, - (1 + transparency) / 2 * 255 AS a, - (1 + transparency) / 2 * (1 - color3) * 255 AS r, - transparency * color1 * 255 AS g, - color2 * 255 AS b + (1 + transparency) / 2 * 255 AS alpha, + (1 + transparency) / 2 * (1 - color3) * 255 AS red, + transparency * color1 * 255 AS green, + color2 * 255 AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND ground_speed > 0 AND ground_speed < 50 AND abs(vertical_rate) > 5000 GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -740,12 +709,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, ['general', 'nordo', 'downed', 'lifeguard', 'reserved', 'unlawful', 'minfuel'], [0x0000FF, 0xFF0000, 0xFFFF00, 0x00FF00, 0x00FFFF, 0xFF00FF, 0xFFFFFF], 0) AS color, - 255 AS a, - avg(color DIV 0x10000) AS r, - avg(color DIV 0x100 MOD 0x100) AS g, - avg(color MOD 0x100) AS b + 255 AS alpha, + avg(color DIV 0x10000) AS red, + avg(color DIV 0x100 MOD 0x100) AS green, + avg(color MOD 0x100) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} AS t WHERE in_tile AND aircraft_emergency NOT IN ('', 'none') GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -775,12 +744,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(altitude), 10000)) / 10000 AS color1, greatest(0, least(avg(ground_speed), 100)) / 100 AS color2, - 255 * color2 AS b, - 255 * color1 AS r, - 255 * (1 - color1) AS g, - 255 * transparency AS a + 255 * color2 AS blue, + 255 * color1 AS red, + 255 * (1 - color1) AS green, + 255 * transparency AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category = 'B2' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -809,12 +778,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, greatest(0, least(avg(ground_speed), 50)) / 50 AS color, - 255 * transparency * color AS g, - 255 * (1 - color) AS r, - 255 * color AS b, - 255 AS a + 255 * transparency * color AS green, + 255 * (1 - color) AS red, + 255 * color AS blue, + 255 AS alpha -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_category IN ('C1', 'C2') GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, @@ -843,12 +812,12 @@ GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024`, cityHash64(substring(aircraft_flight, 1, 3)) AS hash, - transparency * 255 AS a, - avg(hash MOD 256) AS r, - avg(hash DIV 256 MOD 256) AS g, - avg(hash DIV 65536 MOD 256) AS b + transparency * 255 AS alpha, + avg(hash MOD 256) AS red, + avg(hash DIV 256 MOD 256) AS green, + avg(hash DIV 65536 MOD 256) AS blue -SELECT round(r)::UInt8, round(g)::UInt8, round(b)::UInt8, round(a)::UInt8 +SELECT round(red)::UInt8, round(green)::UInt8, round(blue)::UInt8, round(alpha)::UInt8 FROM {table:Identifier} WHERE in_tile AND aircraft_flight != '' -- AND aircraft_category = 'A3' GROUP BY pos ORDER BY pos WITH FILL FROM 0 TO 1024*1024` diff --git a/index.html b/index.html index d17c983..afda797 100644 --- a/index.html +++ b/index.html @@ -204,7 +204,6 @@ Boeing vs. Airbus Helicopters Hi-Performance - Supersonic Light Gliders Ultralight @@ -286,12 +285,12 @@ query_elem.blur(); main_layer_sample100.redraw(); + if (selected_box.length) showReport(); } function setQuery(value) { query_elem.value = value; collapseQueryEditor(); - if (selected_box.length) showReport(); } for (elem of document.querySelectorAll('#examples span')) { @@ -547,8 +546,10 @@ calculateReport(sql_total).then(data => { const row = data[0]; - document.getElementById('report_total').textContent = `Total ${row.traces} traces, ${row.aircrafts} aircrafts of ${row.types} types, ${row.flights} flight nums.`; - document.getElementById('report_time').textContent = `Time: ${row.first} — ${row.last}`; + document.getElementById('report_total').textContent = `Total ${Number(row.traces).toLocaleString()} traces, ${Number(row.aircrafts).toLocaleString()} aircrafts of ${Number(row.types).toLocaleString()} types, ${Number(row.flights).toLocaleString()} flight nums.`; + if (row.traces > 0) { + document.getElementById('report_time').textContent = `Time: ${row.first} — ${row.last}`; + } }); calculateReport(sql_flights).then(data => {