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 thelocation
parameter (e.g.,en-US
). Required iflocation
is 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 iflocation
is not provided.
Automatically detected from theAccept-Language
header ifauto
is specified.time_format
: Default isauto
, can be set to12h
,24h
,24hn
, ornative
.
24hn
represents 24-hour notation without a leading zero.
native
represents the native datetime format (including year) of the language.temperature
: Default isauto
, can be set tocelsius
orfahrenheit
.precipitation
: Default isauto
, can be set tomm
orinch
.wind_speed
: Default isauto
, can be set tomps
,kmph
,mph
, orknot
.
Note thatmph
stands for miles per hour, whilemps
stands for meters per second.air_pressure
: Default isauto
, can be set tohpa
orinhg
.
https://weather-svg.abelia.workers.dev/weather.svg?latitude=36.08297932646632&longitude=140.11147093989302
https://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 install
to install the dependencies. - Start the development Vite server by running
pnpm dev
. - Create a
.dev.vars
file based on.dev.vars.example
and fill in the values. - Preview the API server with
pnpm preview
.
To deploy the API server, follow these steps:
- Edit
wrangler.toml
to match your Cloudflare account and Workers KV namespace ID. - Set the required secrets by running
pnpm wrangler secret put
.
Refer tosrc/server/bindings.ts
for 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.