Skip to content

Commit

Permalink
feat(main): hide contour and sensor (#360)
Browse files Browse the repository at this point in the history
* Added github actions workflow for aut deployment to .72 server.

* Added github action for S3 deployment.

* Changed to staging. Created branch for staging.

* Retrigger deployment workflow.

* fix(studio): zoom in on ios (#192)

# Summary 

- Fixes #186
- The `load` event isn't firing on NOAH Studio. As such, the `centerListener()` method isn't called which is responsible for the zooming in to the selected place. However, `style.load` do get called. The fix implemented here is to also use the event `style.load` to call the methods that were previously called by upon the firing of the `load` event but only listen to `style.load` once.
  - We need to further investigate **why** `load` doesn't work on Studio in iOS but works in KYH
- Confirming that only the NOAH Studio is affected by this issue.
 
# Demo

![Kapture 2021-10-05 at 22 49 45](https://user-images.githubusercontent.com/11599005/136047077-d0da7a85-9157-4d01-bae9-07a6039fd9c1.gif)

* ci(netlify): add _redirects file

* S3 Deployment Validation (#198)

* Added if condition to run workflow only on successful PR merge. (#195)

* Checking proper automation workflow. Will revert this small change upon validation. (#196)

* Change deployment trigger. Revert small biblio change. (#199)

* Checking proper automation workflow. Will revert this small change upon validation.

* Changed trigger for deployment workflow. Revert small change to bibliography.

* Cascade dev changes on workflow to prod (#202)

* Added AWS deployment workflow

* hide contour and sensor from the sidebar

---------

Co-authored-by: pfgoting <pfgoting@gmail.com>
Co-authored-by: Jadurani Davalos <jadurani.davalos@gmail.com>
Co-authored-by: kennethbeoliporada <kennethbeoliporada@gmail.com>
  • Loading branch information
4 people authored Mar 14, 2024
1 parent 0626215 commit 56e90f2
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ export class MapPlaygroundComponent implements OnInit, OnDestroy {
this.addExaggerationControl();
this.addCriticalFacilityLayers();
this.initHazardLayers();
this.initSensors();
//this.initSensors();
this.initQuezonCitySensors();
this.initQCCritFac();
this.initQCMunicipalBoundary();
this.initVolcanoes();
this.initWeatherSatelliteLayers();
this.showContourMaps();
//this.showContourMaps();
this.initQcCenterListener();
this.initLagunaCenterListener();
this.initBarangayBoundary();
Expand Down Expand Up @@ -1097,53 +1097,53 @@ export class MapPlaygroundComponent implements OnInit, OnDestroy {
}

// END OF QC IOT
initSensors() {
SENSORS.forEach((sensorType) => {
this.sensorService
.getSensors(sensorType)
.pipe(first())
.toPromise()
.then((data: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => {
// add layer to map
this.map.addLayer({
id: sensorType,
type: 'circle',
source: {
type: 'geojson',
data,
},
paint: {
'circle-color': SENSOR_COLORS[sensorType],
'circle-radius': 5,
'circle-opacity': 0,
},
});

// add show/hide listeners
combineLatest([
this.pgService.sensorsGroupShown$,
this.pgService.getSensorTypeShown$(sensorType),
])
.pipe(takeUntil(this._changeStyle), takeUntil(this._unsub))
.subscribe(([groupShown, soloShown]) => {
this.map.setPaintProperty(
sensorType,
'circle-opacity',
+(groupShown && soloShown)
);
});

this.pgService.setSensorTypeFetched(sensorType, true);
// show mouse event listeners
this.showDataPoints(sensorType);
})
.catch(() =>
console.error(
`Unable to fetch data from DOST for sensors of type "${sensorType}"`
)
);
});
}
// initSensors() {
// SENSORS.forEach((sensorType) => {
// this.sensorService
// .getSensors(sensorType)
// .pipe(first())
// .toPromise()
// .then((data: GeoJSON.FeatureCollection<GeoJSON.Geometry>) => {
// // add layer to map
// this.map.addLayer({
// id: sensorType,
// type: 'circle',
// source: {
// type: 'geojson',
// data,
// },
// paint: {
// 'circle-color': SENSOR_COLORS[sensorType],
// 'circle-radius': 5,
// 'circle-opacity': 0,
// },
// });

// // add show/hide listeners
// combineLatest([
// this.pgService.sensorsGroupShown$,
// this.pgService.getSensorTypeShown$(sensorType),
// ])
// .pipe(takeUntil(this._changeStyle), takeUntil(this._unsub))
// .subscribe(([groupShown, soloShown]) => {
// this.map.setPaintProperty(
// sensorType,
// 'circle-opacity',
// +(groupShown && soloShown)
// );
// });

// this.pgService.setSensorTypeFetched(sensorType, true);
// // show mouse event listeners
// this.showDataPoints(sensorType);
// })
// .catch(() =>
// console.error(
// `Unable to fetch data from DOST for sensors of type "${sensorType}"`
// )
// );
// });
// }

initVolcanoes() {
// 0 - declare the source json files
Expand Down Expand Up @@ -1742,97 +1742,97 @@ export class MapPlaygroundComponent implements OnInit, OnDestroy {
);
}

showContourMaps() {
const contourMapImages = {
'1hr': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/1hr_latest_rainfall_contour.png',
type: 'image',
},
'3hr': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/3hr_latest_rainfall_contour.png',
type: 'image',
},
'6hr': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/6hr_latest_rainfall_contour.png',
type: 'image',
},
'12hr': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/12hr_latest_rainfall_contour.png',
type: 'image',
},
'24hr': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/24hr_latest_rainfall_contour.png',
type: 'image',
},
'24hr-lapse': {
url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/ph_contour.webm',
type: 'video',
},
};

const getContourMapSource = (contourMapDetails: {
url: string;
type: string;
}): AnySourceData => {
switch (contourMapDetails.type) {
case 'image':
return {
type: 'image',
url: contourMapDetails.url,
coordinates: [
[115.35, 21.55], // top-left
[128.25, 21.55], // top-right
[128.25, 3.85], // bottom-right
[115.35, 3.85], // bottom-left
],
};
case 'video':
return {
type: 'video',
urls: [contourMapDetails.url],
coordinates: [
[115.35, 21.55], // top-left
[128.25, 21.55], // top-right
[128.25, 3.85], // bottom-right
[115.35, 3.85], // bottom-left
],
};
default:
throw new Error('[MapPlayground] Unable to get contour map source');
}
};

Object.keys(contourMapImages).forEach((contourType) => {
const contourMapDetails = contourMapImages[contourType];

this.map.addSource(contourType, getContourMapSource(contourMapDetails));

this.map.addLayer({
id: contourType,
type: 'raster',
source: contourType,
paint: {
'raster-fade-duration': 0,
'raster-opacity': 0,
},
});

combineLatest([
this.pgService.contourMapGroupShown$.pipe(distinctUntilChanged()),
this.pgService.selectedContourMap$.pipe(distinctUntilChanged()),
])
.pipe(
takeUntil(this._unsub),
takeUntil(this._changeStyle),
map(([groupShown, selectedContourMap]) => {
return +(groupShown && selectedContourMap === contourType);
})
)
.subscribe((opacity: number) => {
this.map.setPaintProperty(contourType, 'raster-opacity', opacity);
});
});
}
// showContourMaps() {
// const contourMapImages = {
// '1hr': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/1hr_latest_rainfall_contour.png',
// type: 'image',
// },
// '3hr': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/3hr_latest_rainfall_contour.png',
// type: 'image',
// },
// '6hr': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/6hr_latest_rainfall_contour.png',
// type: 'image',
// },
// '12hr': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/12hr_latest_rainfall_contour.png',
// type: 'image',
// },
// '24hr': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/24hr_latest_rainfall_contour.png',
// type: 'image',
// },
// '24hr-lapse': {
// url: 'https://upri-noah.s3.ap-southeast-1.amazonaws.com/contours/ph_contour.webm',
// type: 'video',
// },
// };

// const getContourMapSource = (contourMapDetails: {
// url: string;
// type: string;
// }): AnySourceData => {
// switch (contourMapDetails.type) {
// case 'image':
// return {
// type: 'image',
// url: contourMapDetails.url,
// coordinates: [
// [115.35, 21.55], // top-left
// [128.25, 21.55], // top-right
// [128.25, 3.85], // bottom-right
// [115.35, 3.85], // bottom-left
// ],
// };
// case 'video':
// return {
// type: 'video',
// urls: [contourMapDetails.url],
// coordinates: [
// [115.35, 21.55], // top-left
// [128.25, 21.55], // top-right
// [128.25, 3.85], // bottom-right
// [115.35, 3.85], // bottom-left
// ],
// };
// default:
// throw new Error('[MapPlayground] Unable to get contour map source');
// }
// };

// Object.keys(contourMapImages).forEach((contourType) => {
// const contourMapDetails = contourMapImages[contourType];

// this.map.addSource(contourType, getContourMapSource(contourMapDetails));

// this.map.addLayer({
// id: contourType,
// type: 'raster',
// source: contourType,
// paint: {
// 'raster-fade-duration': 0,
// 'raster-opacity': 0,
// },
// });

// combineLatest([
// this.pgService.contourMapGroupShown$.pipe(distinctUntilChanged()),
// this.pgService.selectedContourMap$.pipe(distinctUntilChanged()),
// ])
// .pipe(
// takeUntil(this._unsub),
// takeUntil(this._changeStyle),
// map(([groupShown, selectedContourMap]) => {
// return +(groupShown && selectedContourMap === contourType);
// })
// )
// .subscribe((opacity: number) => {
// this.map.setPaintProperty(contourType, 'raster-opacity', opacity);
// });
// });
// }

switchMapStyle(style: MapStyle) {
if (this.mapStyle === style) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@
<noah-weather-satellite-playground
class="w-full"
></noah-weather-satellite-playground>
<noah-contour-maps></noah-contour-maps>
<noah-sensors-group></noah-sensors-group>
<!-- <noah-contour-maps></noah-contour-maps>
<noah-sensors-group></noah-sensors-group> -->
<noah-qc-sensors-group></noah-qc-sensors-group>
<noah-risk-assessment-group class="w-full"></noah-risk-assessment-group>
</div>
Expand Down

0 comments on commit 56e90f2

Please sign in to comment.