Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

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

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...
Hi! You can search my blog here ⤵
Or browse the recent top tags...

Recent Blog Posts

How to remove caked on stickers from old game carts

How to pass parameters to your PHP script via the command line

jPhotoFrame new layout engine explained with examples

Atari Lynx Multi SD Card cartridge review

Jersey JAX-RS filters and interceptors execution order when throwing Exceptions

Why I'll never renew a domain with GoDaddy again

Fake AirPods - HBQ-i7 TWS wireless headset teardown

How to fix Postman error - Failed to import data: format not recognized

Switching out macOS Mail for Microsoft Outlook

Using DeoxIT to repair old game catridges

Recent Galleries

BMB-012 Nanoblock T-Rex Skeleton Model assembly

Tiny Arcade revision 6 kit assembly and decal application

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 1 - introduction and case disassembly

Building a custom Atari Lynx game box storage shelf unit in a day

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity