Skip to content

About

Simple Open-Meteo interface using OpenStreetMap (Nominatim) for city lookup, written in TypeScript for practice

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

openmeteoutil

Simple Open-Meteo interface using OpenStreetMap (Nominatim) for city lookup.

This library handles caching for you, such that you are compliant with the Nominatim terms of use.

CLI

npx openmeteoutil <city> --current   # current weather (default)
npx openmeteoutil <city> --forecast  # 7-day forecast
npx openmeteoutil --clear            # clear all cached data

Cache

Locations fetched: ~/.cache/openmeteoutil/cities.json Weather reports fetched: ~/.cache/openmeteoutil/current.json Weather forecasts fetched: ~/.cache/openmeteoutil/forecast.json

Default refresh times: current: 10 minutes, forecast: 4 hours.

To run the demo from a clone: npm start -- <city>.

Library

import { OpenmeteoClient, NominatimClient } from "openmeteoutil";

const nominatim = new NominatimClient("myapp.locationfetcher");
const openmeteo = new OpenmeteoClient("myapp.forecastfetcher");

const coords = await nominatim.getCoords({ city: "Oslo" });
const now = await openmeteo.getWeather(coords);
const week = await openmeteo.getForecast(coords);

await nominatim.clearCache();      // clear cached locations
await openmeteo.clearCurrentCache();  // clear cached weather reports
await openmeteo.clearForecastCache(); // clear cached forecasts

Exports:

Classes: NominatimClient, OpenmeteoClient

Types: Coords, Location, Weather, Forecast, ForecastDay

Disclaimers and attributions

Unofficial community package. Not affiliated with or endorsed by Open-Meteo.

Weather data by Open-Meteo.com. If you display this data in an app or UI, keep this attribution visible. The free Open-Meteo API is for non-commercial use. See the Open-Meteo terms before commercial use.

City lookup uses Nominatim. Map data © OpenStreetMap contributors.

Note

AI:R - LLM's do not write code for this repo, however they are used as a part of the review process.

License

Copyright (C) 2026 Sofus Højberg Lind

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SPDX-License-Identifier: LGPL-3.0-or-later

About

Simple Open-Meteo interface using OpenStreetMap (Nominatim) for city lookup, written in TypeScript for practice

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages