Eddie Hinkle


Adding weather to my site

I made a goal of adding weather to my site by January 1st, 2018. Today, I'm happy to announce that I completed that goal. Here's what it looks like:

Whenever my site receives a new Micropub post, it does a list of things. Two things that are important for this discussion. First, it pings my Compass server for my current location at the time connected with the post. Second, it uses the Dark Sky API to using the time of the post and my location at that time to get the weather information associated with that time and location and stores it with my post.

On each post page, in the meta data section, I show the weather information from the post. I list the "Feels like" temperature in Fahrenheit along with a weather emoji that shows the weather conditions. Most of the emoji's are what you would expect: ☀️ when it's a clear day, A ❄️ when it's snowing, ☁️ for cloudy and ⛅️ for partly sunny. However, using Dark Sky's weather information, I also have the current phase of the moon in each weather post. This allowed me to do something really fun! If the weather conditions are either clear night or partly cloudy night, when I have the phase of the moon, I replace the generic moon emoji 🌙 with the emoji representing the current phase of the moon. For example, here's a post when the moon was a waxing gibbous:

That felt like a really nice added touch. Dark Sky also provides some more in-depth summary of the weather so I added this as a tooltip when your mouse hovers over the icon:

All in all it didn't take incredibly long to build out and I feel like it adds some real depth to certain photos. Here's to adding more exciting features to my site in 2018!

p.s. part of my New Years goal was to add Xray parsing to my site. It turns out I had already done that and had forgotten. So that part was already complete.

18.13 ℉🌔Frederick, Marylandindiewebindieweb-goals
posted using quill.p3k.io
Please note: This site is in an active redesign. Some things might be a little off 🧐