Igor's Blog

This is a short example on how to change unit type for Yahoo Weather YQL query. This may be an overlooked bit of information but is covered quite well in the Yahoo! Weather Documentation. Mind you this is the RSS feed documentation but since YQL uses this feed as a backend service, you can pass the same parameters into it as you would if you were using the RSS feed directly. This is done using a feature called remote filters.

Here's what the documentation states:
The optional u (units) parameter indicates the degree units for the weather forecast. By default, Yahoo! Weather returns temperature information in degrees Fahrenheit. Use the u parameter to explicitly specify the degree units in Fahrenheit (f) or Celsius (c). The units parameter is case sensitive. For example, to get the weather forecast in Sunnyvale, CA in Celsius:

Note that choosing Celsius degree units changes all the weather units to metric, for example, wind speed will be reported as kilometers per hour and barometric pressure as millibars.


That's great! So lets see how it behaves. I used the following query to test this (here's a YQL Console link to it):
 YQL
select units from weather.forecast
where u='c'
and woeid in (select woeid from geo.places where text="Brisbane, Australia")


Note that the units information is returned in Metric units.
yqlunits1.png




When I change the 'u' parameter to 'f', units are returned in Imperial...
yqlunits2.png


So there you go! Quite easy to do. Here's exactly what you get when you change the unit type:

Set to 'c':
  • Distance - kilometres
  • Speed - kilometres per hour
  • Pressure - millibars
  • Temperature - degrees Celsius


Set to 'f':
  • Distance - miles
  • Speed - miles per hour
  • Pressure - pounds per square inch
  • Temperature - degrees Fahrenheit


-i

, , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
StrFunc() Online
300 George St Blogumentary
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Migrating domain email from GoDaddy to Google G Suite

NeoOffice Viewer macOS Word Document viewer vs Preview and Microsoft Word

Importance of cleaning the internal fans and heatsinks in a MacBook Pro

Adding an email subscribe feature to your Blog with Blogtrottr

How to remove Google's logo from your G Suite applications

Pedestal fan transformed into a ceiling fan

Testing the Velvet WiFi Hotshot signal strength

Improving slow download speeds on the PS4 and PSN

Add batch image resize functionality to macOS using Automator

Show transfer percentage and speed when copying files in Linux and Bash

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth

Friends

RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Please follow me on...