Weather.NET 1.4.0-beta.1

This is a prerelease version of Weather.NET.
dotnet add package Weather.NET --version 1.4.0-beta.1                
NuGet\Install-Package Weather.NET -Version 1.4.0-beta.1                
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="Weather.NET" Version="1.4.0-beta.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Weather.NET --version 1.4.0-beta.1                
#r "nuget: Weather.NET, 1.4.0-beta.1"                
#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.
// Install Weather.NET as a Cake Addin
#addin nuget:?package=Weather.NET&version=1.4.0-beta.1&prerelease

// Install Weather.NET as a Cake Tool
#tool nuget:?package=Weather.NET&version=1.4.0-beta.1&prerelease                

NuGet Package Build Status

Weather.NET

A simple .NET library that uses OpenWeatherMap API to get the weather of different places and cities. Supports both synchronous and asynchronous methods.

Features

Example

using System;
using Weather.NET;
using Weather.NET.Enums;
using Weather.NET.Models.WeatherModel;
using Weather.NET.Models.PollutionModel;

...

WeatherClient client = new WeatherClient("Your API key");

// Gets a forecast of the London weather asynchronously, using the city name.
List<WeatherModel> forecasts = await client.GetForecastAsync("London", 8, Measurement.Metric, Language.Spanish);
Console.WriteLine(forecasts[7].Weather[0].Description);

// Gets the current temperature of New York synchronously, using the ZIP Code.
WeatherModel currentWeather = client.GetCurrentWeather("10001", "US", measurement: Measurement.Imperial);
Console.WriteLine(currentWeather.Main.Temperature);

// Gets maps of the entire world.
client.DownloadWeatherMap("temperatureMap.png", MapLayer.Temperature, 0, 0, 0);
await client.DownloadWeatherMapAsync("pressureMap.png", MapLayer.Pressure, 0, 0, 0);

// Gets the air pollution of Melbourne synchronously, using geo coordinates.
PollutionModel currentPollution = client.GetCurrentAirPollution(-37.814, 144.9633);

// Gets a forecast of the air pollution of Berlin asynchronously, using geo coordinates.
PollutionModel futurePollution = await client.GetForecastAirPollutionAsync(52.5244, 13.4105);

// Gets the history of the air pollution of Buenos Aires asynchronously, using geo coordinates and unix timestamps.
PollutionModel historicalPollution = await client.GetHistoricalAirPollutionAsync(-34.6132, -58.3772);

// Gets OpenWeather's One Call API response of New Delhi.
OneCallModel currentOneCall = client.GetOneCall(28.6128, 77.2311, new ExcludeOneCall[]{ExcludeOneCall.Alerts}, Measurement.Metric, Language.Hindi);

// Gets a historical One Call API response of Ottawa.
OneCallModel historicalOneCall = await client.GetHistoricalOneCallAsync(45.4112, -75.6981, 1640900049, Measurement.Metric, Language.English);
...

Latest Version: 1.3.3

  • Updated to the latest LTS .NET version, .NET 8.

Beta Version: 1.4.0-beta.1

Added support for OpenWeather's GeoCoding API, including a new model and the methods:

  • CoordinatesByLocationName and CoordinatesByLocationNameAsync
  • CoordinatesByZipCode and CoordinatesByZipCodeAsync
  • LocationNameByCoordinates and LocationNameByCoordinatesAsync

Reworked WeatherMap class:

  • Renamed class, from WeatherMap to Maps
  • Added support for OpenStreetMap's Base Street Map (methods GetStreetMapUrl and DownloadStreetMap)
  • Clarified parameter usage (tile coordinates vs. geographical coordinates)
  • Added conversion from geographical to tile coordinates (function LatLongToTileCoordinates)

Fixed deadlock issue on synchronous calls to async methods.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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.

Added support for OpenWeather's GeoCoding API, including a new model and the methods:
 - CoordinatesByLocationName and CoordinatesByLocationNameAsync
 - CoordinatesByZipCode and CoordinatesByZipCodeAsync
 - LocationNameByCoordinates and LocationNameByCoordinatesAsync
Reworked WeatherMap class:
 - Renamed class, from WeatherMap to Maps
 - Added support for OpenStreetMap's Base Street Map (methods GetStreetMapUrl and DownloadStreetMap)
 - Clarified parameter usage (tile coordinates vs. geographical coordinates)
 - Added conversion from geographical to tile coordinates (function LatLongToTileCoordinates)
Fixed deadlock issue on synchronous calls to async methods.