MeteoSwissApi 5.0.9-pre

This is a prerelease version of MeteoSwissApi.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MeteoSwissApi --version 5.0.9-pre
                    
NuGet\Install-Package MeteoSwissApi -Version 5.0.9-pre
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeteoSwissApi" Version="5.0.9-pre" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeteoSwissApi" Version="5.0.9-pre" />
                    
Directory.Packages.props
<PackageReference Include="MeteoSwissApi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeteoSwissApi --version 5.0.9-pre
                    
#r "nuget: MeteoSwissApi, 5.0.9-pre"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MeteoSwissApi@5.0.9-pre
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MeteoSwissApi&version=5.0.9-pre&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MeteoSwissApi&version=5.0.9-pre&prerelease
                    
Install as a Cake Tool

MeteoSwissApi

Version Downloads Buy Me a Coffee

.NET client for easy access of Swiss national weather data. This library is a private, non-commercial project and is by no means related to or maintained by the Federal Office of Meteorology and Climatology MeteoSwiss.

Download and Install MeteoSwissApi

This library is available on NuGet: https://www.nuget.org/packages/MeteoSwissApi Use the following command to install MeteoSwissApi using NuGet package manager console:

PM> Install-Package MeteoSwissApi

You can use this library in any .NET project which is compatible to .NET Standard 2.0 and higher.

API Usage

The following sections document basic use cases of this library. The following code excerpts can also be found in the sample applications.

Request weather info by PLZ

MeteoSwissWeatherService is the main entry point of this library. Create an instance of MeteoSwissWeatherService or inject IMeteoSwissWeatherService using dependency injection techniques.

IMeteoSwissWeatherService weatherService = new MeteoSwissWeatherService(logger, weatherServiceConfiguration);

Request weather information for any Swiss zip code (plz):

var weatherInfo = await weatherService.GetCurrentWeatherAsync(plz: 6330);
Download icons

IMeteoSwissWeatherService provides methods to download icons as SVG image streams. Each method returns the icon stream. If no real icon exists for the given identifier, a transparent 1x1 icon is returned:

Method Description
GetWeatherIconAsync(iconId, weatherIconMapping) Returns the weather icon for the given icon id, e.g. weatherInfo.CurrentWeather.IconV2.
GetWarningIconAsync(warnLevel, warningIconMapping) Returns the warning icon for the given warn level. MeteoSwiss provides warning icons for warn levels 2 to 5; lower warn levels return a transparent 1x1 icon.

Download the weather icon which illustrates the current weather condition:

var weatherIconStream = await weatherService.GetWeatherIconAsync(weatherInfo.CurrentWeather.IconV2);

Weather icons are resolved via IWeatherIconMapping. By default, DefaultWeatherIconMapping downloads the original weather icons from MeteoSwiss. Alternatively, HighContrastWeatherIconMapping serves high-contrast weather icons embedded in this library. You can also provide your own IWeatherIconMapping implementation:

var weatherIconStream = await weatherService.GetWeatherIconAsync(weatherInfo.CurrentWeather.IconV2, new HighContrastWeatherIconMapping());

Weather warnings (weatherInfo.Warnings, weatherInfo.WarningsOverview) report a warn level between 1 and 5. For warn levels 2 to 5, MeteoSwiss provides warning icons which can be downloaded as SVG image streams:

var warningIconStream = await weatherService.GetWarningIconAsync(WarnLevel.Level3);

Warning icons are resolved via IWarningIconMapping. By default, DefaultWarningIconMapping downloads the original warning icons from MeteoSwiss. Alternatively, HighContrastWarningIconMapping serves high-contrast warning icons embedded in this library. You can also provide your own IWarningIconMapping implementation:

var warningIconStream = await weatherService.GetWarningIconAsync(WarnLevel.Level3, new HighContrastWarningIconMapping());

Federal Office of Meteorology and Climatology MeteoSwiss https://www.meteoschweiz.admin.ch

WSL Institute for Snow and Avalanche Research SLF www.slf.ch

Contribution

Contributors welcome! If you find a bug or you want to propose a new feature, feel free to do so by opening a new issue on github.com.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.12-pre 84 10/1/2026
5.0.11-pre 88 9/26/2026
5.0.9-pre 114 9/1/2026
5.0.8-pre 126 8/1/2026
5.0.7-pre 115 7/22/2026
5.0.6-pre 111 7/22/2026
5.0.5-pre 108 7/22/2026
5.0.4-pre 123 7/22/2026
5.0.1-pre 118 7/20/2026
5.0.0-pre 119 7/19/2026
4.1.11 133 7/19/2026
4.1.9-pre 122 7/19/2026
4.1.7-pre 110 7/19/2026
4.1.6-pre 128 7/1/2026
4.1.5-pre 115 6/3/2026
4.1.4-pre 125 6/3/2026
4.1.3-pre 123 6/1/2026
4.1.2-pre 133 5/28/2026
4.1.1-pre 123 5/28/2026
4.1.0-pre 134 5/28/2026
Loading failed

5.0
- Update MeteoSwiss API endpoints from v2 to v3.
- Add new warn type Drought to WarnType.
- Add new method GetWarningIconAsync to download warning icons for warn levels 2 to 5.
- Add warning icon mappings DefaultWarningIconMapping and HighContrastWarningIconMapping.

4.1
- Map the invalid data sentinel (32767) to null in CurrentWeather: properties Temperature and Icon are now nullable.
- Add missing translations for HumidityRanges and PressureRanges.
- Sync station measurement models with full API data.
- Map missing SwissMetNet columns and SLF week snow measurements.
- Add RegionId to Warning model.
- Fix problem with SlfStationType serialization.

4.0
- Replace Newtonsoft.Json with System.Text.Json for JSON serialization.

3.2
- Add model for climate information (KlimaGraph) to WeatherInfo.

3.1
- Extend models Forecast and GraphDetail with new properties

3.0
- Add service to retrieve SwissMetNet weather stations
- Add service to retrieve SLF weather stations
- Add response caching
- Add high-contrast svg icons
- Add support for Microsoft.Extensions.DependencyInjection

2.0
- Replace Temperature type with UnitsNet Temperature

1.3
- Maintenance updates

1.2
- Maintenance updates

1.1
- Add new method GetForecastAsync
- Handle properties WarnType and WarnLevel with custom types

1.0
- Initial release