Mercurial > gemma
changeset 3442:030dc48382c9
Adapt color scheme for waterlevel prediction accuracy
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 24 May 2019 11:37:24 +0200 |
parents | d7ec52232702 |
children | 2eeb5a69d5f2 |
files | client/src/components/map/styles.js schema/geoserver_views.sql |
diffstat | 2 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/styles.js Fri May 24 11:31:43 2019 +0200 +++ b/client/src/components/map/styles.js Fri May 24 11:37:24 2019 +0200 @@ -247,19 +247,19 @@ ); } else { // TODO: Get information from feature and check the ranges according to #423, #424, #425 - let colorWaterlevel; + let colorWaterlevel = "white"; let colorComparison = "lime"; - let colorAccuracy = "yellow"; - let fa = feature.get("forecast_accuracy"); + let colorAccuracy = "white"; + let fa3d = feature.get("forecast_accuracy_3d"); let fa1d = feature.get("forecast_accuracy_1d"); - if (fa === null || fa === undefined) { - colorWaterlevel = "white"; - } else if (fa < 15 && fa1d < 15) { - colorWaterlevel = "lime"; - } else if (fa > 15 && fa1d < 15) { - colorWaterlevel = "yellow"; - } else if (fa1d > 15) { - colorWaterlevel = "red"; + if (typeof fa3d == "number" && typeof fa1d == "number") { + if (fa1d > 15) { + colorAccuracy = "red"; + } else if (fa3d > 15) { + colorAccuracy = "yellow"; + } else { + colorAccuracy = "lime"; + } } let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='white'/>`; let waterlevel = `<polyline points="16,0 24,16 16,32 8,16 16,0" stroke='grey' stroke-width='1' fill='${colorWaterlevel}'/>`;
--- a/schema/geoserver_views.sql Fri May 24 11:31:43 2019 +0200 +++ b/schema/geoserver_views.sql Fri May 24 11:37:24 2019 +0200 @@ -18,7 +18,7 @@ g.source_organization, r.rwls AS reference_water_levels, wl.water_level AS gm_waterlevel, - fca.forecast_accuracy, + fca.forecast_accuracy_3d, fca.forecast_accuracy_1d FROM waterway.gauges g LEFT JOIN (SELECT location, validity, @@ -33,13 +33,13 @@ max(acc) FILTER (WHERE measure_date <= current_timestamp + '1 day'::interval) AS forecast_accuracy_1d, - max(acc) AS forecast_accuracy + max(acc) AS forecast_accuracy_3d FROM waterway.gauge_predictions, GREATEST(water_level - lower(conf_interval), upper(conf_interval) - water_level) AS acc (acc) WHERE measure_date BETWEEN current_timestamp - AND current_timestamp + '4 days'::interval + AND current_timestamp + '3 days'::interval GROUP BY location) AS fca USING (location) WHERE NOT g.erased;