From c1dccbc25a39332d4661f3303255464ad6a9c74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20No=C3=A9?= Date: Thu, 24 Oct 2024 15:54:53 +0200 Subject: [PATCH 1/2] New mechanism to hide some radars from the selection map --- src/CrowTypes.ts | 1 + src/components/SiteSelectorMap.vue | 9 +++++---- src/config.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/CrowTypes.ts b/src/CrowTypes.ts index 4c38388..ced7c97 100644 --- a/src/CrowTypes.ts +++ b/src/CrowTypes.ts @@ -54,6 +54,7 @@ export interface RadarInterface { endpoint: string; // URL template, some variables are interpolated. Example: 'https://opendata.meteo.be/ftp/observations/radar/vbird/{odimCode}/{yyyy}/{odimCode}_vpts_{yyyymmdd}.txt' vptsFileFormat: VPTSFileFormat; heights: number[]; // Data is available at the following heights + hideOnMap?: boolean; // If true, the radar will not be displayed on the map } export type VPTSFileFormat = "VOL2BIRD" | "CSV"; // VOL2BIRD: fixed width column. CSV: Follow BioRad's output (see https://github.com/inbo/crow/issues/135) diff --git a/src/components/SiteSelectorMap.vue b/src/components/SiteSelectorMap.vue index e39297b..f0e3fe4 100644 --- a/src/components/SiteSelectorMap.vue +++ b/src/components/SiteSelectorMap.vue @@ -2,7 +2,7 @@ - + {{ radar.displayLabel }} @@ -44,7 +44,7 @@ export default Vue.extend({ radarsFeatures: function (): d3.ExtendedFeatureCollection { let geojson = { type: "FeatureCollection", features: [] } as d3.ExtendedFeatureCollection - this.radars.forEach(r => { + this.visibleRadars.forEach(r => { let feature = { "type": "Feature", "geometry": { @@ -59,14 +59,15 @@ export default Vue.extend({ return geojson }, - radars: function (): RadarInterface[] { + visibleRadars: function (): RadarInterface[] { // Flat array of radars based on the "sites" prop let r: RadarInterface[] = [] this.sites.forEach(e => { r = r.concat(e.options) }) - return r; + // Filter out radars that have a hideOnMap property set to true + return r.filter(r => r.hideOnMap !== true); }, projection: function (): d3.GeoProjection { return d3.geoMercator() diff --git a/src/config.ts b/src/config.ts index ecedd1a..daa1014 100644 --- a/src/config.ts +++ b/src/config.ts @@ -27,7 +27,7 @@ export default { { odimCode: "behel", text: "Helchteren", latitude: 51.069199, longitude: 5.406138, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, { odimCode: "bejab", text: "Jabbeke", latitude: 51.1919, longitude: 3.0641, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, { odimCode: "bewid", text: "Wideumont", latitude: 49.9135, longitude: 5.5044, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, - { odimCode: "bezav", text: "Zaventem", latitude: 50.9054, longitude: 4.4579, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, + { odimCode: "bezav", text: "Zaventem", latitude: 50.9054, longitude: 4.4579, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD', hideOnMap: false }, ] }, { From 58c95d06e10db949e3ed9e160cfcc7c3f47b9a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20No=C3=A9?= Date: Thu, 24 Oct 2024 16:24:43 +0200 Subject: [PATCH 2/2] Reverted logic --- src/CrowTypes.ts | 2 +- src/components/SiteSelectorMap.vue | 4 ++-- src/config.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CrowTypes.ts b/src/CrowTypes.ts index ced7c97..74c570c 100644 --- a/src/CrowTypes.ts +++ b/src/CrowTypes.ts @@ -54,7 +54,7 @@ export interface RadarInterface { endpoint: string; // URL template, some variables are interpolated. Example: 'https://opendata.meteo.be/ftp/observations/radar/vbird/{odimCode}/{yyyy}/{odimCode}_vpts_{yyyymmdd}.txt' vptsFileFormat: VPTSFileFormat; heights: number[]; // Data is available at the following heights - hideOnMap?: boolean; // If true, the radar will not be displayed on the map + showOnMap?: boolean; // If false, the radar will not be displayed on the map } export type VPTSFileFormat = "VOL2BIRD" | "CSV"; // VOL2BIRD: fixed width column. CSV: Follow BioRad's output (see https://github.com/inbo/crow/issues/135) diff --git a/src/components/SiteSelectorMap.vue b/src/components/SiteSelectorMap.vue index f0e3fe4..8f33c3d 100644 --- a/src/components/SiteSelectorMap.vue +++ b/src/components/SiteSelectorMap.vue @@ -66,8 +66,8 @@ export default Vue.extend({ r = r.concat(e.options) }) - // Filter out radars that have a hideOnMap property set to true - return r.filter(r => r.hideOnMap !== true); + // Filter out radars that have a shownOnMap property set to false + return r.filter(r => r.showOnMap !== false); }, projection: function (): d3.GeoProjection { return d3.geoMercator() diff --git a/src/config.ts b/src/config.ts index daa1014..b6903c7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -27,7 +27,7 @@ export default { { odimCode: "behel", text: "Helchteren", latitude: 51.069199, longitude: 5.406138, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, { odimCode: "bejab", text: "Jabbeke", latitude: 51.1919, longitude: 3.0641, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, { odimCode: "bewid", text: "Wideumont", latitude: 49.9135, longitude: 5.5044, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD' }, - { odimCode: "bezav", text: "Zaventem", latitude: 50.9054, longitude: 4.4579, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD', hideOnMap: false }, + { odimCode: "bezav", text: "Zaventem", latitude: 50.9054, longitude: 4.4579, timezone: "Europe/Brussels", endpoint: meteoBeUrlTemplate, heights: availableHeights, vptsFileFormat: 'VOL2BIRD', showOnMap: true }, ] }, {