diff --git a/app/api/subsetter/main.py b/app/api/subsetter/main.py index 86e9310c..a25d7e34 100644 --- a/app/api/subsetter/main.py +++ b/app/api/subsetter/main.py @@ -57,7 +57,11 @@ app.include_router( fastapi_users.get_oauth_router( - cuahsi_oauth_client, auth_backend, SECRET, redirect_url=get_settings().oauth2_redirect_url + cuahsi_oauth_client, + auth_backend, + SECRET, + redirect_url=get_settings().oauth2_redirect_url, + associate_by_email=True, ), prefix="/auth/cuahsi", tags=["auth"], @@ -68,7 +72,8 @@ cuahsi_oauth_client, auth_backend, SECRET, - redirect_url=get_settings().vite_oauth2_redirect_url + redirect_url=get_settings().vite_oauth2_redirect_url, + associate_by_email=True, ), prefix="/auth/front", tags=["auth"], diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json index facbdc22..0a368570 100644 --- a/app/frontend/package-lock.json +++ b/app/frontend/package-lock.json @@ -13,6 +13,7 @@ "leaflet": "^1.9.4", "leaflet-easybutton": "^2.4.0", "pinia": "^2.1.6", + "proj4": "^2.9.2", "swagger-ui": "^5.9.0", "vite-plugin-vuetify": "^1.0.2", "vue": "^3.3.4", @@ -4264,6 +4265,11 @@ "node": ">= 8" } }, + "node_modules/mgrs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mgrs/-/mgrs-1.0.0.tgz", + "integrity": "sha512-awNbTOqCxK1DBGjalK3xqWIstBZgN6fxsMSiXLs9/spqWkF2pAhb2rrYCFSsr1/tT7PhcDGjZndG8SWYn0byYA==" + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -5011,6 +5017,15 @@ "node": ">= 0.6.0" } }, + "node_modules/proj4": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.9.2.tgz", + "integrity": "sha512-bdyfNmtlWjQN/rHEHEiqFvpTUHhuzDaeQ6Uu1G4sPGqk+Xkxae6ahh865fClJokSGPBmlDOQWWaO6465TCfv5Q==", + "dependencies": { + "mgrs": "1.0.0", + "wkt-parser": "^1.3.3" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -6661,6 +6676,11 @@ "node": ">= 8" } }, + "node_modules/wkt-parser": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.3.3.tgz", + "integrity": "sha512-ZnV3yH8/k58ZPACOXeiHaMuXIiaTk1t0hSUVisbO0t4RjA5wPpUytcxeyiN2h+LZRrmuHIh/1UlrR9e7DHDvTw==" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/app/frontend/package.json b/app/frontend/package.json index cf654368..145d34b9 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -19,6 +19,7 @@ "leaflet": "^1.9.4", "leaflet-easybutton": "^2.4.0", "pinia": "^2.1.6", + "proj4": "^2.9.2", "swagger-ui": "^5.9.0", "vite-plugin-vuetify": "^1.0.2", "vue": "^3.3.4", diff --git a/app/frontend/src/components/SubmitButton.vue b/app/frontend/src/components/SubmitButton.vue index afa173ce..e9bbbb60 100644 --- a/app/frontend/src/components/SubmitButton.vue +++ b/app/frontend/src/components/SubmitButton.vue @@ -22,6 +22,7 @@ import { useAlertStore } from '../stores/alerts' import { ENDPOINTS } from '@/constants' import { useMapStore } from '@/stores/map' import { fetchWrapper } from '@/_helpers/fetchWrapper'; +import proj4 from 'proj4' import { mdiSend } from '@mdi/js' import { computed } from 'vue'; @@ -65,8 +66,32 @@ async function submitHucs(selected_hucs, model) { } async function submitBbox(bbox, model) { - const [xmin, ymin, xmax, ymax] = bbox - const params = `y_south=${ymin}&y_north=${ymax}&x_west=${xmin}&x_east=${xmax}` + let [xmin, ymin, xmax, ymax] = bbox + const lowerLeft = [xmin, ymin] + // const upperLeft = [xmin, ymax] + const upperRight = [xmax, ymax] + // const lowerRight = [xmax, ymin] + + // https://github.com/derhuerst/transform-coordinates + // import transformation from 'transform-coordinates' + // const transformation = require('transform-coordinates') + // https://epsg.io/3082 + // const transform = transformation('EPSG:4326', '3082') // WGS 84 to LCC + + let firstProjection = proj4('EPSG:3857') + let secondProjection = '+proj=lcc +lat_1=30 +lat_2=60 +lat_0=40.0000076293945 +lon_0=-97 +x_0=0 +y_0=0 +a=6370000 +b=6370000 +units=m +no_defs' + + const lccLowerLeft = proj4(firstProjection, secondProjection, lowerLeft) + // const lccUpperLeft = proj4(secondProjection, upperLeft) + const lccUpperRight = proj4(firstProjection, secondProjection, upperRight) + // const lccLowerRight = proj4(secondProjection, lowerRight) + + ymin = lccLowerLeft[1] + xmin = lccLowerLeft[0] + xmax = lccUpperRight[0] + ymax = lccUpperRight[1] + + const params = `y_south=${ymin}&y_north=${ymax}&x_west=${xmax}&x_east=${xmin}` fetchWrapper.post(`${ENDPOINTS.submit}/${model}?${params}`) }