From acfbcb5fb2946f33454bc3a1658f3580d917eebc Mon Sep 17 00:00:00 2001 From: mgtennant <100305096+mgtennant@users.noreply.github.com> Date: Mon, 27 Nov 2023 19:39:01 -0800 Subject: [PATCH 1/7] add aermod html file --- frontend/public/aermod.html | 537 +++++++++++++++++++++++++++ frontend/public/index.html | 20 +- frontend/public/js/gis/geomapping.js | 37 ++ frontend/src/app.controller.ts | 14 +- frontend/src/main.ts | 21 +- 5 files changed, 611 insertions(+), 18 deletions(-) create mode 100644 frontend/public/aermod.html diff --git a/frontend/public/aermod.html b/frontend/public/aermod.html new file mode 100644 index 0000000..cd27a30 --- /dev/null +++ b/frontend/public/aermod.html @@ -0,0 +1,537 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BC Air Quality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+

Weather Research and Forecasting Model (WRF) Data

+
+

+ Click the "Search" button after specifying the spatial domain and + time range using any of the search tab options below. Locate and + select the "DOWNLOAD Data" icon that pops up to begin downloading + the WRF data package. Extract the content of the package into a + dedicated folder and open the included readme file (i.e., + Readme.txt) for instructions on next steps. If you have any + questions, please email + bcdispersion.model@gov.bc.ca. +

+
+
+
+
+
+ + +
+
+
+
+ + +
+ + + + + + + + + diff --git a/frontend/public/index.html b/frontend/public/index.html index 7bf70b9..cd71548 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -177,21 +177,35 @@

BC Air Quality

+ - diff --git a/frontend/public/js/gis/geomapping.js b/frontend/public/js/gis/geomapping.js index 1be96ec..9423e28 100644 --- a/frontend/public/js/gis/geomapping.js +++ b/frontend/public/js/gis/geomapping.js @@ -764,6 +764,43 @@ require([ } + search4 = function () { + var sStartDate = $('#startDate').val(); + var sEndDate = $('#endDate').val(); + var sLatitude = $("#sLatitude").val(); + var sLongitude = $("#sLongitude").val(); + + // if users enter a positive longitude, convert to a negative value for them. + if (sLongitude >= 0) { + sLongitude = sLongitude*-1; + } + + if (isNaN(sLatitude) || sLatitude == 0) { + alert("You must enter a valid latitude in the format ##.######"); + return; + } + if (isNaN(sLongitude) || sLongitude == 0) { + alert("You must enter a valid longitude in the format ##.######"); + return; + } + + if (sLatitude > 63 || sLatitude < 45 || sLongitude < -146 || sLongitude > -106) { + alert("You have entered a coordinate outside of the bounds of this application."); + return; + } + + if (!validateDate(sStartDate)) { + return; + } + + if (!validateDate(sEndDate)) { + return; + } + + // TODO change this + downloadDialog({ latitude: sLatitude, longitude: sLongitude }); + } + sketch.on("create", function (event) { // clear the screen of any popups or previous graphics if (event.state === "start") { diff --git a/frontend/src/app.controller.ts b/frontend/src/app.controller.ts index 5296936..a2a55f6 100644 --- a/frontend/src/app.controller.ts +++ b/frontend/src/app.controller.ts @@ -1,15 +1,19 @@ /* eslint-disable no-useless-constructor */ -import { Render } from '@nestjs/common'; -import { Controller, Get } from '@nestjs/common' -require('dotenv').config(); +import { Render } from "@nestjs/common"; +import { Controller, Get } from "@nestjs/common"; +require("dotenv").config(); @Controller() export class AppController { @Get() - @Render('index') + @Render("index") async root() {} - @Get('esriConfig') + @Get("aermod") + @Render("aermod") + async aermod() {} + + @Get("esriConfig") async esriConfig() { return process.env.esriConfigApiKey; } diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 8bea3b3..12e1836 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,14 +1,15 @@ -import { NestFactory } from '@nestjs/core' -import { NestExpressApplication } from '@nestjs/platform-express'; -import { AppModule } from './app.module' -import { join } from 'path'; +import { NestFactory } from "@nestjs/core"; +import { NestExpressApplication } from "@nestjs/platform-express"; +import { AppModule } from "./app.module"; +import { join } from "path"; -async function bootstrap () { - const app = await NestFactory.create(AppModule); - app.enableCors(); - app.useStaticAssets(join(__dirname, '..', 'public')); - app.setViewEngine('html'); +async function bootstrap() { + const app = await NestFactory.create(AppModule, { + cors: true, + }); + app.useStaticAssets(join(__dirname, "..", "public")); + app.setViewEngine("html"); await app.listen(3000); } -bootstrap() +bootstrap(); From 90aa602702e5bdd5e4f564ca78791767ee00207f Mon Sep 17 00:00:00 2001 From: mgtennant <100305096+mgtennant@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:50:38 -0800 Subject: [PATCH 2/7] grid map- working on download --- frontend/public/aermod.html | 34 +- frontend/public/js/gis/geomapping.js | 37 - frontend/public/js/gis/geomapping_aermod.js | 754 ++++++++++++++++++++ 3 files changed, 771 insertions(+), 54 deletions(-) create mode 100644 frontend/public/js/gis/geomapping_aermod.js diff --git a/frontend/public/aermod.html b/frontend/public/aermod.html index cd27a30..c6ed65a 100644 --- a/frontend/public/aermod.html +++ b/frontend/public/aermod.html @@ -139,6 +139,8 @@ + + @@ -189,7 +191,7 @@ } } - + @@ -374,23 +376,21 @@

Weather Research and Forecasting Model (WRF) Data