Commit 0484a252 authored by alain's avatar alain 🐙
Browse files

handle sensor statusses better

parent 1ad2b255
......@@ -4,6 +4,11 @@ export const textsNL = {
loading: "Bezig met laden...",
loadingError: "Laden mislukt...",
loadingRetry: "Probeer opnieuw",
status: [
"offline",
"geen recente data",
"online, maar nog geen gekalibreerde data"
],
nodata: "geen data...",
lastMean: "laatste uurgemiddelde",
lastPeak: "piekwaarde laatste uur",
......
......@@ -12,6 +12,8 @@ import { mapControlSettings, mapItemSettings } from "../../../config/map"
const hexagonOffset = 0.86603
// factor of max value in parameter range when we assume a sensor went cuckoo
const cuckooThreshold = 2
const radiusScale = scaleLinear([mapControlSettings.zoomMax, mapControlSettings.zoomMin], [mapItemSettings.sizeMin, mapItemSettings.sizeMax])
......@@ -80,7 +82,11 @@ class StationLayer extends CompositeLayer {
getElevation: d => getHeight(d.mean, zoom),
getPosition: d => this.getCoordinates(d, count, radius),
getFillColor: d => {
if(d.mean === null || d.mean > range[1]*cuckooThreshold) {
if(d.status === 2) { // online, but no value
let color = getColorArray(getColor(range[0], legend, (scale === 'log')))
color[3] = color[3] * 0.5
return color
} else if(d.mean === null || d.mean > range[1]*cuckooThreshold) { // no value or above cuckoo range
let color = getColorArray(mapItemSettings.colorOffline)
color[3] = color[3] * 0.5
return color
......
......@@ -22,9 +22,9 @@ const SensorTooltip = props => {
<td><strong>{ roundBy(d.mean, 1) }{ unit }</strong></td>
</tr>
}
{ d.mean === null &&
{ d.mean === null && d.status !== null &&
<tr>
<td>{ texts.nodata }</td>
<td>{ texts.status[d.status] }</td>
</tr>
}
</tbody></table>
......
......@@ -6,7 +6,7 @@ class MapAttributions extends React.Component {
<div className="mapboxgl-ctrl-bottom-right">
<div className="mapboxgl-ctrl mapboxgl-ctrl-attrib">
<div className="mapboxgl-ctrl-attrib-inner">
<span>v. 06/01/2020</span>
<span>v. 08/01/2020</span>
<span><a href="https://waag.org" target="_blank" rel="noopener noreferrer">waag</a></span>
<span>© <a href="http://www.openstreetmap.org/about/" target="_blank" rel="noopener noreferrer">OpenStreetMap</a></span>
</div>
......
......@@ -59,6 +59,10 @@
}
}
h1 {
padding-right: 1rem;
}
.description {
margin-bottom: 32px;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment