Creating a weather app using PowerApps

One of the great things about PowerApps is that every month it gets better and better with more capabilities in the platform as well as new connectors that provide more flexibility connecting to SaaS services. Last month one of such connectors was the MSN Weather that gives you the ability to read the current weather on a specific location, or even the forecast for tomorrow and others.

MSN Weather API

While I don’t think you want to build the next Weather App (there are plenty out there), having the capability of incorporating weather information to your application and correlate to any other data on it is very powerful, whether for planning purposes, delivery, travel plans, or scheduling, or others it can save your users from having to go to multiple places. In addition, with Microsoft Flow you could setup some automated tasks that trigger when the weather changes, and such.

MSN Weather Connector actions supported in PowerApps

What we will be building

For this quick sample we will be creating the following application using PowerApps that allow you to enter a location in the Input box and will provide you the weather, conditions, pressure, and other information. It also allows you to use the current location to get the weather for it. We currently do not have a reverse geocoding API but the MSN Weather API allows you to provide the Location in coordinates. Of course like all other PowerApps, this application will run in iOS (iPhone, iPad), Android, Windows Phone, Web, and Windows Desktop which makes it extremely powerful and all of this in less than five minutes.

Building the Weather App

At a high level the strategy we will use since we want to have the user click the “Search button” as an explicit action, we’ll store the result of calling MSNWeather.CurrentWeather in the OnSelect of the Search button into a context variable that then we’ll use to display in all the other controls. We’ll add another icon to set the current location coordinates. That’s it… nothing else needed.

In Windows, launch PowerApps

We’ll initialize the default location when first launching the app, for that: on the Screen set the following properties:

OnVisible = UpdateContext({LastLocation: "Redmond, WA"})

We’ll add the “set the current location” button, for that: Add an Icon (I used the “Map”) icon for simplicity and set the following properties:

All is Good but in my view, But one thing that every Weather app lacking: either Weather apps display a lot of unrequited alerts for weather changes (talking about google app) but i never seen even a single alert when it should be. So, i have faith in MS and i think this app will gonna overcome this issue. Now, i am upto using this app.