Weather.svg is a server-based widget that generates animated weather widget images in SVG format. It provides weather information in a visually appealing way.
Leeds, UK (displayed in your preferred language and units)
Greenwich, US (displayed in English, regular time, Fahrenheit, and imperial units)
Tsukuba, Japan (displayed in Japanese, military time, Celsius, and metric units)
Add the following query parameters to the URL of the API server: https://weather-svg.abelia.workers.dev/weather.svg.
latitude: Required. Must be a value between -90 and 90.longitude: Required. Must be a value between -180 and 180.location: Optional. Specify a custom name for the location. If provided, reverse geocoding will not be used.location_lang: Optional. Specify the language for thelocationparameter (e.g.,en-US). Required iflocationis specified.
Alternatively, you can use encrypted_location instead of the above parameters.
To obtain encrypted_location, add &encrypt to the end of the plain location URL.
All of these parameters are optional.
lang: Default isauto, can be set to a BCP 47 tag, e.g.,en-US.
Specifies the language of the weather information, the datetime format, and the location name iflocationis not provided.
Automatically detected from theAccept-Languageheader ifautois specified.time_format: Default isauto, can be set to12h,24h,24hn, ornative.
24hnrepresents 24-hour notation without a leading zero.
nativerepresents the native datetime format (including year) of the language.temperature: Default isauto, can be set tocelsiusorfahrenheit.precipitation: Default isauto, can be set tommorinch.wind_speed: Default isauto, can be set tomps,kmph,mph, orknot.
Note thatmphstands for miles per hour, whilempsstands for meters per second.air_pressure: Default isauto, can be set tohpaorinhg.
https://weather-svg.abelia.workers.dev/weather.svg?latitude=36.08297932646632&longitude=140.11147093989302https://weather-svg.abelia.workers.dev/weather.svg?latitude=41.945053494801634&longitude=-72.64589591337739&lang=en-US&time_format=12h&precipitation=inch&temperature=fahrenheit&wind_speed=mph
To start development, make sure you have Node.js and pnpm installed.
The required versions are specified in package.json.
We recommend using proto to install the necessary tools.
Follow these steps:
- Clone this repository.
- Run
pnpm installto install the dependencies. - Start the development Vite server by running
pnpm dev. - Create a
.dev.varsfile based on.dev.vars.exampleand fill in the values. - Preview the API server with
pnpm preview.
To deploy the API server, follow these steps:
- Edit
wrangler.tomlto match your Cloudflare account and Workers KV namespace ID. - Set the required secrets by running
pnpm wrangler secret put.
Refer tosrc/server/bindings.tsfor the necessary secrets. - Deploy your API server with
pnpm wrangler deploy.
For automatic deployment using GitHub Actions, make sure to add CLOUDFLARE_API_TOKEN to your actions secrets.
For more information, see Create an API token.
Please feel free to open an issue for any bug or feature request. Pull requests are also welcome.
This project is licensed under the MIT License.
- Weather data by Open-Meteo, CC BY 4.0.
- Locality data by BigDataCloud.
- Icons from Meteocons by Bas Milius, MIT License.