cmfcmf / OpenWeatherMap-PHP-API

A PHP API to parse weather data and weather history from OpenWeatherMap.org.
https://cmfcmf.github.io/OpenWeatherMap-PHP-API
MIT License
328 stars 123 forks source link

Feature request: wind in km/hour instead of m/s #37

Open iamgoodbytes opened 9 years ago

iamgoodbytes commented 9 years ago

In Europe, we tend to say "20 km/hour" when talking about wind speed, not meters/second. It might be a valuable addition to get the speed in km's?

cmfcmf commented 9 years ago

I am not sure whether or not something like this should be part of the library. The Celsius / degree fix is done to normalise the API. A conversion would however add additional logic. I might consider to add it through an additional static class like UnitConverter, which might take a unit object as an argument and a target unit string as second parameter. How does that sound?

iamgoodbytes commented 9 years ago

At this moment I had written my own conversion, but that feels like a hack. The ideal case would be to have it in the API's response but that's unlikely to happen. Second best to me would be a UnitConverter class like you mentioned, but included in your library. If you consider this to be an edge case, I'll keep my own conversion logic in my code. I guess it's up to you to decide if this would serve your library or not!

Kickball commented 8 years ago

I'd find this quite useful! :+1:

KarelWintersky commented 5 years ago

In Russia we tend to say "20 m/s" when talking about wind speed.

"Own conversion" (m/s to km/h vice versa) is not a hack.