-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/UW-Macrostrat/web
* 'main' of https://github.com/UW-Macrostrat/web: ta1-maps -> ta1-results Updated names of CriticalMAAS files Bring rasters back in CDR maps changes
- Loading branch information
Showing
16 changed files
with
86 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
pages/dev/cdr-maps/@cog_id/@system/@system_version/+data.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# CriticalMAAS integration | ||
|
||
- [TA1 results](./criticalmaas/ta1-results) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// CriticalMAAS CDR integration | ||
// Proxy requests to /tile/* to https://api.cdr.land/v1/tiles/* | ||
// Add the Authorization header to the proxied request | ||
// | ||
|
||
import proxy from "express-http-proxy"; | ||
|
||
export function createCDRProxy() { | ||
// TODO: CDR needs to accept authentication so that we can stop proxying requests. | ||
// OR tile endpoints need to be public. | ||
const proxyAddress = process.env.CDR_API_BASE ?? "https://api.cdr.land"; | ||
const proxyToken = process.env.CDR_API_KEY; | ||
|
||
if (!proxyToken || !proxyAddress) { | ||
return null; | ||
} | ||
|
||
return proxy(proxyAddress, { | ||
proxyReqOptDecorator: (opts) => { | ||
opts.headers["Authorization"] = `Bearer ${proxyToken}`; | ||
return opts; | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
pages/dev/cdr-maps/+data.ts → ...rations/criticalmaas/ta1-results/+data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
pages/integrations/criticalmaas/ta1-results/@cog_id/@system/@system_version/+data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { PageContext } from "vike/types"; | ||
|
||
export async function data(pageContext: PageContext) { | ||
const { cog_id, system, system_version } = pageContext.routeParams; | ||
const baseURL = pageContext.urlParsed.origin; | ||
const url = `${baseURL}/cdr/v1/tiles/cog/${cog_id}/system/${system}/system_version/${system_version}`; | ||
|
||
const res = await fetch(url); | ||
const data = await res.json(); | ||
|
||
// Get projected COG info | ||
const projInfo = await fetch( | ||
`${baseURL}/cdr/v1/maps/cog/projections/${cog_id}` | ||
); | ||
const projData = await projInfo.json(); | ||
|
||
// Get first validated projection | ||
// This could probably be improved | ||
const matchingProj = projData.find((d) => d.status == "validated"); | ||
|
||
const rasterURL = matchingProj?.download_url; | ||
|
||
return { | ||
cog_id, | ||
system, | ||
system_version, | ||
rasterURL, | ||
envelope: data.web_geom, | ||
}; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters