Skip to content

Commit

Permalink
Merge branch 'lambert-conformal-conic' into subsetter_front
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Jan 10, 2024
2 parents c602b05 + dfe8ece commit 7b37203
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/api/subsetter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down
20 changes: 20 additions & 0 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
29 changes: 27 additions & 2 deletions app/frontend/src/components/SubmitButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`)
}
Expand Down

0 comments on commit 7b37203

Please sign in to comment.