OpenWeatherMapSharp 4.1.0
dotnet add package OpenWeatherMapSharp --version 4.1.0
NuGet\Install-Package OpenWeatherMapSharp -Version 4.1.0
<PackageReference Include="OpenWeatherMapSharp" Version="4.1.0" />
<PackageVersion Include="OpenWeatherMapSharp" Version="4.1.0" />
<PackageReference Include="OpenWeatherMapSharp" />
paket add OpenWeatherMapSharp --version 4.1.0
#r "nuget: OpenWeatherMapSharp, 4.1.0"
#:package OpenWeatherMapSharp@4.1.0
#addin nuget:?package=OpenWeatherMapSharp&version=4.1.0
#tool nuget:?package=OpenWeatherMapSharp&version=4.1.0
OpenWeatherMapSharp
A .NET client wrapper for https://openweathermap.org written in .NET Standard 2.0
Installation
Install the package via NuGet.
Usage
First you need to get a free API key from openweathermap.org. You can create a new account and you will find your API keys on your API keys page.
You need to create a new instance of OpenWeatherMapService
passing in the API key. There is also an interface available, if you are using Dependency Injection.
/// <summary>
/// Gets forecast data for a location based
/// on its geographic coordinates.
/// </summary>
Task<OpenWeatherMapServiceResponse<ForecastRoot>> GetForecastAsync(
double latitude,
double longitude,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets forecast data based on a city ID.
/// </summary>
[Obsolete]
Task<OpenWeatherMapServiceResponse<ForecastRoot>> GetForecastAsync(
int cityId,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets forecast data based on a city name.
/// </summary>
[Obsolete]
Task<OpenWeatherMapServiceResponse<ForecastRoot>> GetForecastAsync(
string city,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets current weather data for a location based on its geographic coordinates.
/// </summary>
Task<OpenWeatherMapServiceResponse<WeatherRoot>> GetWeatherAsync(
double latitude,
double longitude,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets current weather data based on a city ID.
/// </summary>
[Obsolete]
Task<OpenWeatherMapServiceResponse<WeatherRoot>> GetWeatherAsync(
int cityId,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets current weather data based on a city name.
/// </summary>
[Obsolete]
Task<OpenWeatherMapServiceResponse<WeatherRoot>> GetWeatherAsync(
string city,
LanguageCode language = LanguageCode.EN,
Unit unit = Unit.Standard);
/// <summary>
/// Gets a list of matching locations for a given query string.
/// </summary>
Task<OpenWeatherMapServiceResponse<List<GeocodeInfo>>> GetLocationByNameAsync(
string query,
int limit = 5);
/// <summary>
/// Gets geolocation information based on a ZIP or postal code.
/// </summary>
Task<OpenWeatherMapServiceResponse<GeocodeZipInfo>> GetLocationByZipAsync(
string zipCode);
/// <summary>
/// Gets a list of matching locations for a given pair of coordinates.
/// </summary>
Task<OpenWeatherMapServiceResponse<List<GeocodeInfo>>> GetLocationByLatLonAsync(
double latitude,
double longitude,
int limit = 5);
/// <summary>
/// Retrieves current air pollution data for a specific location.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionAsync(
double latitude,
double longitude);
/// <summary>
/// Retrieves forecasted air pollution data for the coming days for a specific location.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionForecastAsync(
double latitude,
double longitude);
/// <summary>
/// Retrieves historical air pollution data for a specific location and time range.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionHistoryAsync(
double latitude,
double longitude,
DateTime start,
DateTime end);
HINT: Some methods are marked as obsolete
, because openweathermap.org marked these methods as depracted. Currently they are all still working, but might be removed in feature releases. They recommend using the methods with latitude and longitude to get the current weather or the forecast.
License
Product | Versions 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 was computed. |
.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. |
-
.NETStandard 2.0
- System.Text.Json (>= 9.0.7)
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 |
---|---|---|
4.1.0 | 434 | 7/24/2025 |
4.0.1 | 483 | 7/23/2025 |
4.0.0 | 489 | 7/22/2025 |
3.1.4 | 712 | 11/27/2023 |
3.1.3 | 488 | 11/27/2023 |
3.1.2 | 530 | 10/9/2023 |
3.1.1 | 557 | 10/3/2023 |
3.1.0 | 569 | 10/2/2023 |
3.0.0 | 541 | 9/30/2023 |
2.0.2 | 1,203 | 3/12/2021 |
2.0.1 | 1,174 | 9/4/2020 |
2.0.0 | 1,155 | 9/4/2020 |
1.1.0 | 2,391 | 10/18/2017 |
1.0.1 | 2,048 | 9/17/2017 |
1.0.0 | 2,248 | 9/17/2017 |
- Add icon urls to ForecastItem