mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
feat(weather): global rain radar from RainViewer
Add a Global (RainViewer) option to Rain radar beside the US MRMS radar. The proxy pins RainViewer's tile host, validates frames and Web Mercator tile coordinates, and limits upstream tile requests to 80 a minute. Globe basemaps draw the tiles; on 3D Tiles the shell composes them into one equirectangular image per frame and detail window. Co-authored-by: Sandiv Dathunarachchi <[email protected]>
This commit is contained in:
1 parent
e7707d9a0f
commit
d496dd9f33
21 files changed
+1207
-81
No files matched your search
@@ -0,0 +1,12 @@
|
||||
/** Admit at most 80 requests in a rolling minute; return retry seconds or zero.
|
||||
* Call only at the upstream boundary, after cache lookup and coalescing. */
|
||||
export function createRainViewerGovernor() {
|
||||
const attempts = [];
|
||||
return (now) => {
|
||||
while (attempts.length && now - attempts[0] >= 60_000) attempts.shift();
|
||||
if (attempts.length >= 80)
|
||||
return Math.max(1, Math.ceil((60_000 - (now - attempts[0])) / 1000));
|
||||
attempts.push(now);
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user