Is there a way to change the temp from Centegrade to Farenheit ? Are the factors setable like windspeed in mph?
Is there a way to change the temp from Centegrade to Farenheit ? Are the factors setable like windspeed in mph?
Hello Donald,
The Weather app sample use the Current Open Weather Map API, and, yes, that API provide us with certain Units options. For example, the below URL:
Retrieve information using the Standard metrics unit.
But this other URL:
Retrieve the information using the Imperial units. So what we can do is to take in count the "units" argument in the URL, which can be "imperial" or "metric". If we simply omit this argument in the URL then the default units are "metric".
Ok that makes sense but where do I change the string to show Imperial? I cannot find it anywhere.
One of the problems I have is that code can be in so many different places I cannot find them. Is there any place that all the code shows up? Or anyway to search for a string in the app like "openweathermap.org" ?
Thanks
Is it part of this file?
https://www.decsoftutils.com/Humm/Sites/Main/Views/Data/AppBuilder/Samples/Weather/weather.php
Hello Donald,
We can't use the Open Weather Map API directly from the application due to CORS limitations. So, how the application get the data from the API? The application uses a PHP script, who communicate with the Open Wheather API without CORS issues.
You can view such PHP script into the application folder and is in that PHP script in which we can view the Open Weather Map URL and then can add the appropiate argument (units) to it. If we plain to allow the application's user to change between units, then we must include in the application's HTTP call (used to retrieve the data) a new argument.
So the application inform to the PHP script to use the metric or the imperial unit. Probably I have sometime tomorrow in order to modify the Weather application sample in order to include the "units" option, then you can view how I implement it. Of course I take note about your suggestion. Of course a "global search engine" can be good, as well other things like a "code map". Good ideas.
Hello,
I forget to mention the Weather sample is a little special, in the sense that the first app's view (the home or main view) does not contain any button nor other control. In fact we use the view Show event with this code:
And there is the "GetWeatherData" app's function, which is responsible to retrieve the information from the app's server, that is, from the Open Weather Map API. Below is the "GetWeatherData" app's function:
Above we can see how we conform the appropiate URL, including the city we want to retrieve their weather. At this point we must modify that code in order to add another argument (the "units") into the URL. Then our PHP script receive such arguments and perform the appropiate Open Weather Map API call.
Hello,
Update your App Builder copy Donald: I add a new "unit" option into the Weather app sample.
Hey that is great David. Thanks for that. You make me smile with your great service.
I am surely going to do something with this.
Don
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.
Este sitio utiliza "cookies" útiles para almacenar sus preferencias.