Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<RepositoryType>GIT</RepositoryType>
<PackageTags>.NET Azure Maps REST API </PackageTags>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>7.1.0.0</AssemblyVersion>
<RootNamespace>AzureMapsToolkit</RootNamespace>
<FileVersion>7.0.0.0</FileVersion>
<FileVersion>7.1.0.0</FileVersion>
<Authors>Per Fahlen,Vincent Baaij</Authors>
<Copyright>© 2021</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
99 changes: 98 additions & 1 deletion AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System.Text;
using Azure.Core.GeoJson;
using AzureMapsToolkit.Elevation;
using AzureMapsToolkit.Weather;
//using Newtonsoft.Json.Linq;

namespace AzureMapsToolkit
Expand Down Expand Up @@ -1152,7 +1153,6 @@ public virtual async Task<Response<TrafficIncidentViewportResult>> GetTrafficInc

#endregion


#region Elevation
public virtual async Task<Response<ElevationResult>> GetElevationDataForBoundingBox(GetElevationDataForBoundingBoxRequest req)
{
Expand Down Expand Up @@ -1227,5 +1227,102 @@ public virtual async Task<Response<ElevationResult>> PostElevationDataForPolylin

#endregion

#region Weather

/// <summary>
/// Get Current Conditions service returns detailed current weather conditions such as precipitation, temperature and wind for a given coordinate location. Also, observations from the past 6 or 24 hours for a particular location can be retrieved. The basic information returned with the response include details such as observation date and time, brief description of the weather conditions, weather icon, precipitation indicator flags, and temperature. Additional details such as RealFeel™ Temperature and UV index are also returned.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<CurrentConditionsResponse>> GetCurrentCondition(GetCurrentConditionsRequest req)
{
var res = await ExecuteRequest<CurrentConditionsResponse, GetCurrentConditionsRequest>($"{baseDomain}/weather/currentConditions/json", req);
return res;
}


/// <summary>
/// The service returns detailed weather forecast such as temperature and wind by day for the next 1, 5, 10, 15, 25, or 45 days for a given coordinate location. The response include details such as temperature, wind, precipitation, air quality, and UV index.
/// In S0 you can request daily forecast for the next 1, 5, 10, and 15 days. In S1 you can also request daily forecast for the next 25 days, and 45 days.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<DailyForecastResponse>> GetDailyForecast(GetForecastRequest req)
{
var res = await ExecuteRequest<DailyForecastResponse, GetForecastRequest>($"{baseDomain}/weather/forecast/daily/json", req);
return res;
}

/// <summary>
/// There may be times when you want to know if the weather conditions are optimal for a specific activity, for example, for outdoor construction, indoor activities, running or farming including soil moisture information. Azure Maps Indices API returns index values that will guide end users to plan future activities. For example, a health mobile application can notify users that today is good weather for running or for other outdoors activities like for playing golf, and retail stores can optimize their digital marketing campaigns based on predicted index values. The service returns in daily indices values for current and next 5, 10 and 15 days starting from current day.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<DailyIndicesResponse>> GetDailyIndices(GetDailyIndicesRequest req)
{
var res = await ExecuteRequest<DailyIndicesResponse, GetDailyIndicesRequest>($"{baseDomain}/weather/indices/daily/json", req);
return res;
}

/// <summary>
/// Request detailed weather forecast by the hour for the next 1, 12, 24 (1 day), 72 (3 days), 120 (5 days), and 240 hours (10 days) for the given the given coordinate location. The API returns details such as temperature, humidity, wind, precipitation, and ultraviolet (UV) index.
/// In S0 you can request hourly forecast for the next 1, 12, 24 hours (1 day), and 72 hours (3 days). In S1 you can also request hourly forecast for the next 120 (5 days) and 240 hours (10 days).
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<HourlyForecastResponse>> GetHourlyForecast(GetHourlyForecastRequest req)
{
var res = await ExecuteRequest<HourlyForecastResponse, GetHourlyForecastRequest>($"{baseDomain}/weather/forecast/hourly/json", req);
return res;
}

/// <summary>
/// Get Minute Forecast service returns minute-by-minute forecasts for a given location for the next 120 minutes. Users can request weather forecasts in the interval of 1, 5 and 15 minutes. The response will include details such as the type of precipitation (including rain, snow, or a mixture of both), start time, and precipitation intensity value (dBZ).
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<MinuteForecastResponse>> GetMinuteForecast(GetMinuteForecastRequest req)
{
var res = await ExecuteRequest<MinuteForecastResponse, GetMinuteForecastRequest>($"{baseDomain}/weather/forecast/minute/json", req);
return res;
}

/// <summary>
/// Service returns detailed weather forecast by quarter-day for the next 1, 5, 10, or 15 days for a given location. Response data is presented by quarters of the day - morning, afternoon, evening, and overnight. Details such as temperature, humidity, wind, precipitation, and UV index are returned.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<QuarterDayForecastResponse>> GetQuarterDayForecast(GetForecastRequest req)
{
var res = await ExecuteRequest<QuarterDayForecastResponse, GetForecastRequest>($"{baseDomain}/weather/forecast/quarterDay/json", req);
return res;
}
/// <summary>
/// Severe weather phenomenon can significantly impact our everyday life and business operations. For example, severe weather conditions such as tropical storms, high winds or flooding can close roads and force logistics companies to reroute their fleet causing delays in reaching destinations and breaking the cold chain of refrigerated food products.  Azure Maps Severe Weather Alerts API returns the severe weather alerts that are available worldwide from both official Government Meteorological Agencies and leading global to regional weather alert providers. The service can return details such as alert type, category, level and detailed description about the active severe alerts for the requested location, like hurricanes, thunderstorms, lightning, heat waves or forest fires.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<SevereWeatherAlertsResponse>> GetSevereWeatherAlerts(GetSevereWeatherAlertsRequest req)
{
var res = await ExecuteRequest<SevereWeatherAlertsResponse, GetSevereWeatherAlertsRequest>($"{baseDomain}/weather/severe/alerts/json", req);
return res;
}

/// <summary>
/// Weather along a route API returns hyper local (one kilometer or less), up-to-the-minute weather nowcasts, weather hazard assessments, and notifications along a route described as a sequence of waypoints. This includes a list of weather hazards affecting the waypoint or route, and the aggregated hazard index for each waypoint might be used to paint each portion of a route according to how safe it is for the driver. When submitting the waypoints, it is recommended to stay within, or close to, the distance that can be traveled within 120-mins or shortly after. Data is updated every five minutes.
/// The service supplements Azure Maps Route Service that allows you to first request a route between an origin and a destination and use that as an input for Weather Along Route endpoint
/// In addition, the service supports scenarios to generate weather notifications for waypoints that experience an increase in intensity of a weather hazard. For example, if the vehicle is expected to begin experiencing heavy rain as it reaches a waypoint, a weather notification for heavy rain will be generated for that waypoint allowing the end product to display a heavy rain notification before the driver reaches that waypoint. The trigger for when to display the notification for a waypoint could be based, for example, on a geofence, or selectable distance to the waypoint.
/// The API covers all regions of the planet except latitudes above Greenland and Antarctica.
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public virtual async Task<Response<WeatherAlongRouteResponse>> GetWeatherAlongRoute(GetWeatherAlongRouteRequest req)
{
var res = await ExecuteRequest<WeatherAlongRouteResponse, GetWeatherAlongRouteRequest>($"{baseDomain}/weather/route/json", req);
return res;
}

#endregion

}
}
14 changes: 13 additions & 1 deletion AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using AzureMapsToolkit.Spatial;
using AzureMapsToolkit.Timezone;
using AzureMapsToolkit.Traffic;
using AzureMapsToolkit.Weather;

namespace AzureMapsToolkit
{
Expand Down Expand Up @@ -141,9 +142,20 @@ public interface IAzureMapsServices
Task<Response<ElevationResult>> GetElevationDataForBoundingBox(GetElevationDataForBoundingBoxRequest req);

Task<Response<ElevationResult>> GetElevationDataForPoints(GetElevationDataForPointsRequest req);

Task<Response<ElevationResult>> GetElevationDataForPolyline(GetElevationDataForPolylineRequest req);

Task<Response<ElevationResult>> PostElevationDataForPoints(PostDataForPoints[] req);

Task<Response<ElevationResult>> PostElevationDataForPolyline(PostDataForPolylineRequest req, PostDataForPolylineData[] data);

Task<Response<CurrentConditionsResponse>> GetCurrentCondition(GetCurrentConditionsRequest req);
Task<Response<DailyForecastResponse>> GetDailyForecast(GetForecastRequest req);
Task<Response<DailyIndicesResponse>> GetDailyIndices(GetDailyIndicesRequest req);
Task<Response<HourlyForecastResponse>> GetHourlyForecast(GetHourlyForecastRequest req);
Task<Response<MinuteForecastResponse>> GetMinuteForecast(GetMinuteForecastRequest req);
Task<Response<QuarterDayForecastResponse>> GetQuarterDayForecast(GetForecastRequest req);
Task<Response<SevereWeatherAlertsResponse>> GetSevereWeatherAlerts(GetSevereWeatherAlertsRequest req);
Task<Response<WeatherAlongRouteResponse>> GetWeatherAlongRoute(GetWeatherAlongRouteRequest req);
}
}
39 changes: 39 additions & 0 deletions AzureMapsRestToolkit/AzureMapsRestToolkit/Weather/AirAndPollen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;

namespace AzureMapsToolkit.Weather
{
public class AirAndPollen
{
/// <summary>
/// Category of the air quality or pollution type. For example, low, high, good, moderate, unhealthy, hazardous.
/// </summary>
[JsonPropertyName("category")]
public string Category { get; set; }

/// <summary>
/// Value associated with the air quality or pollution category. These values range from 1 to 6. 1 implying good conditions, 6 implying hazardous conditions.
/// </summary>
[JsonPropertyName("categoryValue")]
public int CategoryValue { get; set; }

/// <summary>
/// Name of the pollen or pollutant. For example, grass, mold, weed, air quality, tree and UV index.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }

/// <summary>
/// Only exists for air quality. Examples include ozone and particle pollution.
/// </summary>
[JsonPropertyName("type")]
public string Type { get; set; }

/// <summary>
/// Value of the given type above. Values associated with mold, grass, weed and tree are in units of parts per cubic meter. Both air quality and UV are indices, so they are unitless.
/// </summary>
[JsonPropertyName("value")]
public int Value { get; set; }


}
}
51 changes: 51 additions & 0 deletions AzureMapsRestToolkit/AzureMapsRestToolkit/Weather/AlertArea.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Text.Json.Serialization;

namespace AzureMapsToolkit.Weather
{
public class AlertArea
{
/// <summary>
/// Full details associated with the alert. Returned if details=True. This field is always returned in the language(s) of choice by the issuing provider and Azure Maps only returns what is created by the provider. Please note, some countries/regions may offer their native language and English. Language parameter won’t apply to this field.
/// </summary>
[JsonPropertyName("alertDetails")]
public string AlertDetails { get; set; }

/// <summary>
/// Language of the alertDetails. This field helps to point out that the language of the alertDetails may differ from the requested language parameter. Returned if details=True. Language code has been derived from the ISO 639-1 Alpha-2 codes.
/// </summary>
[JsonPropertyName("alertDetailsLanguageCode")]
public string AlertDetailsLanguageCode { get; set; }

/// <summary>
/// The end date and time of the alert in ISO 8601 format, for example, 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the response is the local time to the requested coordinate location.
/// </summary>
[JsonPropertyName("endTime")]
public string EndTime { get; set; }

/// <summary>
/// The latest status of the alert in the current area.
/// </summary>
[JsonPropertyName("latestStatus")]
public LatestStatus LatestStatus { get; set; }

/// <summary>
/// The name of an area which is affected by the alert. The location that was requested falls under the alert area.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }

/// <summary>
/// The start date and time of the alert in ISO 8601 format, for example, 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the response is the local time to the requested coordinate location.
/// </summary>
[JsonPropertyName("startTime")]
public string StartTime { get; set; }

/// <summary>
/// Text summarizing the alert in the returned area.
/// </summary>
[JsonPropertyName("summary")]
public string Summary { get; set; }


}
}
33 changes: 33 additions & 0 deletions AzureMapsRestToolkit/AzureMapsRestToolkit/Weather/Color.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;

namespace AzureMapsToolkit.Weather
{
public class Color
{
/// <summary>
/// Blue component of the RGB value
/// </summary>
[JsonPropertyName("blue")]
public int Blue { get; set; }

/// <summary>
/// Green component of the RGB value.
/// </summary>
[JsonPropertyName("green")]
public int Green { get; set; }

/// <summary>
/// Hexadecimal color value.
/// </summary>
[JsonPropertyName("hex")]
public string Hex { get; set; }

/// <summary>
/// Red component of the RGB value.
/// </summary>
[JsonPropertyName("red")]
public int Red { get; set; }


}
}
Loading