Azure Maps Weather Services
Blog|by Jamie Maguire|4 November 2020
An introduction to Azure Maps Weather Services, Radar, and Infrared Tile Overlays
In an earlier blog post we looked Azure Maps and Power BI. One of the concepts that was touched on was the concept of tile layers and how these can be used to superimpose images on top of Azure Maps base map tiles.
In this blog post we take a closer look at Tiles. We’ll also cover:
- Azure Maps Weather Services
- How to use the Azure Maps Weather Service API to fetch the Daily Forecast
- Using the Get Map Tiles API to fetch tiles that contain real-time weather data
Watch the recording of our Azure Maps webinar, The Location of Things: Smart Cities with Azure Maps, IoT and Digital Twins over on our YouTube channel, link here
We’ll see how to combine all of the above in a sample web page that contains an Azure Map that contains real-time weather data.
Azure Maps uses the Spherical Mercator projection coordinate system to transform our circular planet into a flat map. This flattened out map is then divided up into a series of square tiles that can then be manipulated or zoomed in and out of at varying levels. For example, a zoom level of one would use four tiles to render the world into a 2 x 2 square:
With the information in this format it’s then possible to convert locations into pixel coordinates. For example, here we can see the globe represented as pixels:
To help optimise the performance of map manipulation and rendering, this map is cut up into a collection of smaller tiles which we can see here:
With the planet represented in this format (Azure Maps base map tiles) it’s then easier to apply information from GeoJSON or other data sources to specific locations on the map.
This can include data such as environmental, traffic or even weather data.
Azure Map Weather Services
Azure Maps Weather data services provide tiles that can include, but are not limited to, radar tiles, current weather conditions, weather forecasts and the weather along a given route.
Some of the weather endpoints currently available let you:
- Get Daily Forecast
- Get Current Weather Conditions
- Get Hourly Forecast
- Get Minute Forecast
- Get Quarter Day Forecast Preview
- Get Severe Weather Alerts
- Get Weather Along Route (Preview)
You can find a list of all available endpoints and supplementary information here
Example: Calling the Get Daily Forecast using Postman
In this example we are calling the Get Daily Forecast service. We pass in our subscription key and the latitude and longitude that we want the daily forecast for:
Daily Forecast JSON Response
After the Daily Forecast service has been invoked, we can see the JSON below has been returned. This contains valuable insights such as:
- Temperature min and max values
- Hours of sunlight
- Air quality
- Wind strength
You will notice files such as:
These correspond to icons like the following (where 3 is the Icon Code):
With the information in this format, you can use it to render graphical visualisations or easy to understand dashboards. You can find out more about the available unit types and icons here
Example: Calling the Get Weather Along Route
This API combines up-to-the-minute weather data and weather hazard assessments with notifications for a given route and their respective waypoints. You can use it to create overlays that identify how safe a route is for the driver.
Unlike some of the other APIs, this API covers all regions of the planet (excluding latitudes above Greenland and Antarctica).
Like the earlier API we looked at, you construct an HTTP request. Here we can see an example request:
Get Weather Along Route JSON Response
The API provides a JSON response that can include notifications for weather alerts such as heavy rain, lightning, snow, and much more. For example, here we can see fragment of the return JSON:
At the time of writing, Azure Maps doesn’t have the same level of coverage and accuracy for all countries and regions. Find out more information regarding coverage here
Demo: Adding Weather Radar and Infrared Tile overlays to an Azure Map
In this demo, we’re using Azure Map Weather Services to fetch tiles that contain real time weather data for the UK and Europe. We then apply this to an Azure Map.
Creating the Request
First, we create the following request:
The key parameter to look at in this query string is: tilesetId=microsoft.weather.radar.main. Passing in this parameter fetches the latest infrared satellite images and clouds by their temperatures.
Running our code results in the following:
On their own, the colours don’t mean too much but if we look at the map legend for Radar Tile Data, we can see there is the possibility of light rain in the UK:
We can amend the query string to return infrared tiles:
Doing so results in the following:
Checking out the map legend for the infrared images we can see the temperature is low:
You can find out more information about additional legends and hex codes here
You’re probably thinking of ways that you can leverage some of these APIs, GeoJSON and out of the box insights from some of the existing tile sets that are on offer. Here are some ideas of my own I had while experimenting with Azure Maps.
Dynamic AdTech and marketing campaigns
Is tomorrow going to be a scorcher? Use Azure insights from Azure Weather Services to dynamically generate and serve creative or increase stock such as ice cream.
Automated traffic planning
The Azure Flow Tile API serves 256 x 256 pixel tiles that contain traffic flow information. Each tile contains information that lets you see at-a-glance the speed of traffic along specific road segments or if traffic is free flowing. Use this information to augment your existing traffic planning capabilities.
Health and safety systems
Road conditions or real-time severe weather alerts can be crucial from a health and safety system. Use the Get Severe Weather Alerts API to build an early alert and notification system to optimise your business operations.
In this blog post we’ve explored Azure Maps. We’ve introduced Tiles and how existing services such as Azure Weather Services can return tiles that contain rich insights such as traffic information or weather data. Finally, we explored some further use cases.
View the recording of our recent Azure Maps webinar here
Grey Matter has a team of mapping experts who can help you get started with Azure and Azure Maps. Reach out to them with your questions or to dsicuss your use case: email@example.com or +44 (0)1364 655133.
Contact Grey Matter
If you have any questions or want some extra information, complete the form below and one of the team will be in touch ASAP. If you have a specific use case, please let us know and we'll help you find the right solution faster.
Software Architect, Consultant, Developer, and Microsoft AI MVP. 15+ years’ experience architecting and building solutions using the .NET stack. Into tech, web, code, AI, machine learning, business and start-ups.
Tue 24 January 2023 10:00 am - 11:00 am GMT
Learn how Microsoft 365 defends against cyber threats facing businesses today, and get an overview of the impressive security features it contains in our January webinar. Grey Matter’s Microsoft 365 expert, Adam Blackwell will highlight the security features contained in...
January 2023 marks the end of the extended period of support for Windows 7. Windows 7 Extended Security Updates, first announced in January 2020, was introduced as a last resort for customers who were still using legacy Microsoft products past...