Change MP/H to KM/S

Hello,
I would like to implement the weather forecast.
It seems to work, but the wind speed is in MP/H, and I want it to be changed in KM/H and if possible convert it to wind force.

Can anybody help me with this?

Regards, Peter

Hello,

problem 1 solved by choosing Canada for Units. Now I have KM/H.
But I also would like to show the windspeed, in force. For example windspeed of 6-10 km/h is wind force 2, and wind speed 20 - 28 km/h is windforce 4. Etc.

Any idea how to get started with this issue?

Regards, Peter

We can only show the data that Darksky give us, which I believe is MPH/KPH.

If the force value is in the data returned, then you could edit the widget template and select that value in preference to the MPH/KPH.

Hi,
No, Darksky don’t returned the value of windforce.

I have Peter programmed a Javascript to do the job.

Greetings Torsten

Hi Alex,

As forummember SteitzTo also mentioned: via a javascript it is possible to convert the windspeed to windforce.
It is working perfect.

Regards, Peter

Hi
here are the Javascript for convert Km/h in Beaufort. I hope it help’s other guy’s

<center><span style="font-size:45px"> Windspeed:</span></center>
<br>
<br>
<center>
<span style="font-size:70px">
<script type="text/javascript">
var windspeed;
windspeed ='[windSpeed]';

if (windspeed <=1.85) {document.write("<b><span style=color:#ffffff>0</span> <b>")};
if (windspeed >=1.85 && windspeed <=7.41) {document.write("<b><span style=color:#ECECFF>1</span> <b>")};
if (windspeed >=7.41 && windspeed <=12.96) {document.write("<b><span style=color:#D9D9FF>2</span> <b>")};
if (windspeed >=12.96 && windspeed <=20.37) {document.write("<b><span style=color:#C5C5FF>3</span> <b>")};
if (windspeed >=20.37 && windspeed <=29.63) {document.write("<b><span style=color:#B0B0FF>4</span> <b>")};
if (windspeed >=29.63 && windspeed <=40.74) {document.write("<b><span style=color:#9B9BFF>5</span> <b>")};
if (windspeed >=40.74 && windspeed <=51.86) {document.write("<b><span style=color:#8383FF>6</span> <b>")};
if (windspeed >=51.86 && windspeed <=62.97) {document.write("<b><span style=color:#6868FF>7</span> <b>")};
if (windspeed >=62.97 && windspeed <=75.93) {document.write("<b><span style=color:#6868FF>8</span> <b>")};
if (windspeed >=75.93 && windspeed <=88.90) {document.write("<b><span style=color:#0000FF>9</span> <b>")};
if (windspeed >=88.90 && windspeed <=103.71) {document.write("<b><span style=color:#0000BB>10</span> <b>")};
if (windspeed >=103.71 && windspeed <=118.53) {document.write("<b><span style=color:#000077>11</span> <b>")};
if (windspeed >=118.53) {document.write("<b><span style=color:#000000>12</span> <b>")};
</script>
</span>
</center>

Greetings Torsten

1 Like