OpenWeatherMap PowerShell Module
2 min read

OpenWeatherMap PowerShell Module

There's no better to way to learn something new than to make a thing. Yesterday I had a strong desire to know what the weather was like from my command prompt. I can't explain it--I just had to and I thought, "Hey, it can't be that bad, right?" I decided to try writing and releasing an open-source PowerShell module.

It turned out to be very easy, in fact. There's an awesome project called OpenWeatherMap where you can sign up for a free API key and go to town on their open data API--limited to 60 calls a minute which isn't a problem for my pet project.

So, what happens when you combine PowerShell and an open weather API? Weather in your command prompt!

Weather

I've released the module on GitHub and the PowerShell Gallery for your enjoyment. I've already added weather symbols (Unicode is cool) and I'm adding friendly forecasting next.

You can set up your PowerShell profile to get the weather each time you boot your prompt, following the example on GitHub.

This also sets up an alias for weather so you can ad-hoc get the weather too:

weather command

I plan to add the ability to get a quick forecast, so you can know what to plan for the next morning before you get into work! There's probably more neat stuff we can do with coloring the weather conditions but maybe you want to open a PR then?

One interesting thing I noticed was that the Windows Command Prompt (and PowerShell) does not support some Unicode characters. For example, you can probably see this:

�&

But if you try pasting that into command prompt you'll see:

no symbols

So that was a little disappointing--it meant I had to stick to the Unicode symbols that worked in the prompt, which is still a good amount but not as a granular as it could potentially be.

I am not sure why Windows doesn't support those characters but maybe in a future Windows 10 update they'll add support!

Enjoying these posts? Subscribe for more