Files
davisfe.cz/scratch_openmeteo.ts
2026-06-05 23:34:13 +02:00

20 lines
587 B
TypeScript

import axios from 'axios';
import { lakesConfig } from './scripts/lakesConfig';
async function testOpenMeteo() {
const lipno = lakesConfig.find(l => l.id.startsWith('VLL1'));
if (!lipno) return;
const lat = lipno.coords[0];
const lon = lipno.coords[1];
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,precipitation`;
console.log('Fetching from:', url);
try {
const response = await axios.get(url);
console.log(response.data.current);
} catch (e) {
console.error(e.message);
}
}
testOpenMeteo();