Author Topic: Meteotemplate - new free website template  (Read 638254 times)

0 Members and 1 Guest are viewing this topic.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3075 on: June 14, 2016, 01:23:29 PM »
Hi,

I make a query to the database to load the data and that is then used to feed the graph.

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3076 on: June 14, 2016, 01:24:33 PM »
Hi,

I make a query to the database to load the data and that is then used to feed the graph.

Ok.

Can you show the code?

Regards

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3077 on: June 14, 2016, 01:32:22 PM »
Ok, so this for example is one of the queries used for the monthly report to get the data from the database:

Code: [Select]
$result = mysqli_query($con,"
SELECT avg(T), avg(Tmin), avg(Tmax), avg(H), avg(P), avg(D), avg(W), avg(G), avg(A), avg(S), max(T), max(Tmin), max(Tmax), max(H), max(P), max(D), max(W), max(G), max(A), max(S), min(T), min(Tmin), min(Tmax), min(H), min(P), min(D), min(W), min(G), min(A), min(S), stddev(T), stddev(Tmin), stddev(Tmax), stddev(H), stddev(P), stddev(D), stddev(W), stddev(G), stddev(A), stddev(S), max(RR)
FROM alldata
WHERE $span
GROUP BY YEAR(DateTime), MONTH(DateTime)
"
);

But it wont be much of use to you, because this always depends on how exactly you structure your tables and database.

It then all gets more complicated once you start using Ajax so that the page does not have to be refreshed to load new data.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3078 on: June 14, 2016, 01:34:56 PM »
Also you should be careful and protect your scripts from SQL injections

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3079 on: June 14, 2016, 01:35:56 PM »
Ok, so this for example is one of the queries used for the monthly report to get the data from the database:

Code: [Select]
$result = mysqli_query($con,"
SELECT avg(T), avg(Tmin), avg(Tmax), avg(H), avg(P), avg(D), avg(W), avg(G), avg(A), avg(S), max(T), max(Tmin), max(Tmax), max(H), max(P), max(D), max(W), max(G), max(A), max(S), min(T), min(Tmin), min(Tmax), min(H), min(P), min(D), min(W), min(G), min(A), min(S), stddev(T), stddev(Tmin), stddev(Tmax), stddev(H), stddev(P), stddev(D), stddev(W), stddev(G), stddev(A), stddev(S), max(RR)
FROM alldata
WHERE $span
GROUP BY YEAR(DateTime), MONTH(DateTime)
"
);

But it wont be much of use to you, because this always depends on how exactly you structure your tables and database.

It then all gets more complicated once you start using Ajax so that the page does not have to be refreshed to load new data.

Thanks, but how do you load it into HighCharts?  8-)

Kind Regards


Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3080 on: June 14, 2016, 05:04:48 PM »
Depends if you want to use Ajax or not, if you simply want to have it as a static graph, then you create an array from the query results and then echo it wherever your Highcharts script is. With Ajax it is much more complicated, it looks much better and is much more convenient for the user, but for you as a developer it means you need to set up the ajax call, create a separate script to generate the results and then use JSON to parse it and then insert into the graph.

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3081 on: June 14, 2016, 05:09:38 PM »
Depends if you want to use Ajax or not, if you simply want to have it as a static graph, then you create an array from the query results and then echo it wherever your Highcharts script is. With Ajax it is much more complicated, it looks much better and is much more convenient for the user, but for you as a developer it means you need to set up the ajax call, create a separate script to generate the results and then use JSON to parse it and then insert into the graph.

Ajax :grin:
Is it possible to see the separate script and JSON/parsing/inserting?

Kind Regards

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5533
    • KomokaWeather
Re: Meteotemplate - new free website template
« Reply #3082 on: June 14, 2016, 05:36:50 PM »
Radial Graphs added, and yes quite interesting to look at.  Took me a while to get my head around it but think I now understand it.

Again, thanks Jachym

Paul

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3083 on: June 14, 2016, 06:28:53 PM »
Depends if you want to use Ajax or not, if you simply want to have it as a static graph, then you create an array from the query results and then echo it wherever your Highcharts script is. With Ajax it is much more complicated, it looks much better and is much more convenient for the user, but for you as a developer it means you need to set up the ajax call, create a separate script to generate the results and then use JSON to parse it and then insert into the graph.

Ajax :grin:
Is it possible to see the separate script and JSON/parsing/inserting?

Kind Regards

OK, so lets assume a simple situation where you just want to update the data (it becomes even more complicated when you are changing also the parameters, because then you need to update not just the data, but also the axis lables, units etc.).

So your first script has the code with the Highcharts graph and the HTML. And it has no data specified.
Then there is an ajax call which can be triggered by either some user interaction (pressing a button etc.) or on load.
This script calls the other script and sends some parameter, so for example you click a button "today" so it would send "today" to that script.
This script takes this parameter, based on that creates the query to the database and then encodes the results in JSON and sends it back to the original script. This script than decodes the JSON and updates the graph with this data.

Offline SimonB

  • Contributor
  • ***
  • Posts: 139
    • meteo.capetown
Re: Meteotemplate - new free website template
« Reply #3084 on: June 15, 2016, 03:02:15 AM »
New Plugin - Air Traffic

To make it complete, in addition to the marine traffic plugin you can now also include a plugin showing the current air traffic around your station location.

Data is taken from two different sources and in addition you can customize the plugin by selecting if you do/do not want to show airports and also if you want to include labels next to the planes and if so, what that label should show (speed, altitude, from/to etc.).

Demo: http://www.meteotemplate.com/template/plugins/airTraffic/index.php

I've actually got an ADS-B receiver on my roof.



Sent from my F35 Lightning II using Tapatalk

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3085 on: June 15, 2016, 04:54:09 AM »
Depends if you want to use Ajax or not, if you simply want to have it as a static graph, then you create an array from the query results and then echo it wherever your Highcharts script is. With Ajax it is much more complicated, it looks much better and is much more convenient for the user, but for you as a developer it means you need to set up the ajax call, create a separate script to generate the results and then use JSON to parse it and then insert into the graph.

Ajax :grin:
Is it possible to see the separate script and JSON/parsing/inserting?

Kind Regards

OK, so lets assume a simple situation where you just want to update the data (it becomes even more complicated when you are changing also the parameters, because then you need to update not just the data, but also the axis lables, units etc.).

So your first script has the code with the Highcharts graph and the HTML. And it has no data specified.
Then there is an ajax call which can be triggered by either some user interaction (pressing a button etc.) or on load.
This script calls the other script and sends some parameter, so for example you click a button "today" so it would send "today" to that script.
This script takes this parameter, based on that creates the query to the database and then encodes the results in JSON and sends it back to the original script. This script than decodes the JSON and updates the graph with this data.

Thanks, that is also how I would do it, I guess.

Can you show the code?  :grin: Just for one parameter, fx temperature.

Kind Regards


Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3086 on: June 15, 2016, 05:36:16 AM »
Hi,
I deliberately didnt show the code - not that it would be a secret :D I mean you can download the entire template with all the scripts, but more because this is highly specific. It depends on exactly how you structured your database, how you structured your graphs etc. Ajax is actually something that took me quite a while to understand and the best thing is to start with something simple. I then built it up and what you would see now in the template is the result of this, but posting the code here would rather confuse you, especially if you do not know how my template works in the back end, because many parts in the code have nothing to do with Ajax as such and are connected with other functions that are part of the template. In other words, they would not work if you simply copy/paste it, because it is all interconnected with the rest of the template.
If I were you I would start with just static Highcharts graphs if you want to see how to work with it with MySQL. And then start building it up gradually and once this is working, look on the internet for some simple Ajax examples and go from there. It would not be good I think for me to now post the code here because that would only confuse you - for example some functions are included in other files so they would not be in the code even though they are otherwise needed etc.

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3087 on: June 15, 2016, 05:41:26 AM »
Hi,
I deliberately didnt show the code - not that it would be a secret :D I mean you can download the entire template with all the scripts, but more because this is highly specific. It depends on exactly how you structured your database, how you structured your graphs etc. Ajax is actually something that took me quite a while to understand and the best thing is to start with something simple. I then built it up and what you would see now in the template is the result of this, but posting the code here would rather confuse you, especially if you do not know how my template works in the back end, because many parts in the code have nothing to do with Ajax as such and are connected with other functions that are part of the template. In other words, they would not work if you simply copy/paste it, because it is all interconnected with the rest of the template.
If I were you I would start with just static Highcharts graphs if you want to see how to work with it with MySQL. And then start building it up gradually and once this is working, look on the internet for some simple Ajax examples and go from there. It would not be good I think for me to now post the code here because that would only confuse you - for example some functions are included in other files so they would not be in the code even though they are otherwise needed etc.

Hi

I understand what you are saying.

I already use HighCharts with static non-sql data so I already know a thing or two  :grin:

I will take a look at your template.

Thanks Jáchym, have a nice day.

Kind Regards

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3088 on: June 15, 2016, 06:09:50 AM »
Hi,
feel free to ask, please dont take it I dont want to help you or dont want to share the code.... as I said, you can even download it all, the only problem is that if I posted the code, it would not be ideal for three reasons:
- things are "missing" (because they might be included in other files of the template, which are loaded on each page)
- things are different (for example there are functions for the language translations, unit conversions etc. - these are my custom made functions which are included in those other files and would throw an error on your site, because are not normally part of PHP)
- things are redundant - parts of the code deal with other stuff necessary for the template but otherwise not needed for a general Ajax call

Since you havent used Meteotemplate it would be hard for you to tell what is what because you dont know how it works in the back end. If you want I can help you install it. You could give it a try and you would see how it works and you could then also modify it to your likings. Maybe that would be even better for you because you would just be modifying something that already works which is always easier :D

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Important Changes!
« Reply #3089 on: June 15, 2016, 07:31:52 AM »
Hi guys,
due to changes at the NWS website it is necessary to update some scripts in your template. If you do not do so, your interactive banner and the METAR section of your page will NOT WORK as of tomorrow. It should not be difficult to fix this, just go to the Downloads section at Meteotemplate.com and download the latest bug fixes package that I prepared yesterday, which includes the updated files. Then simply replace the original and things should be working again.

Best regards
Jachym

http://www.meteotemplate.com/web/download.php

Offline Brett001

  • Member
  • *
  • Posts: 38
Re: Meteotemplate - new free website template
« Reply #3090 on: June 15, 2016, 10:27:03 AM »
Hi Jachym,

The new clientraw parser plug-in is very cool. :) I like it!

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3091 on: June 15, 2016, 01:20:41 PM »
I have added a new station icon for Raspberry Pi in the Extras section:

http://www.meteotemplate.com/web/extras.php



There is now a new user that uses it.

I am also posting this so that in case you also own a station that looks nothing like any of the icons available at the moment, let me know and I will make one for you too.

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Meteotemplate - new free website template
« Reply #3092 on: June 15, 2016, 01:48:36 PM »
Hi,
feel free to ask, please dont take it I dont want to help you or dont want to share the code.... as I said, you can even download it all, the only problem is that if I posted the code, it would not be ideal for three reasons:
- things are "missing" (because they might be included in other files of the template, which are loaded on each page)
- things are different (for example there are functions for the language translations, unit conversions etc. - these are my custom made functions which are included in those other files and would throw an error on your site, because are not normally part of PHP)
- things are redundant - parts of the code deal with other stuff necessary for the template but otherwise not needed for a general Ajax call

Since you havent used Meteotemplate it would be hard for you to tell what is what because you dont know how it works in the back end. If you want I can help you install it. You could give it a try and you would see how it works and you could then also modify it to your likings. Maybe that would be even better for you because you would just be modifying something that already works which is always easier :D

Thanks Jáchym  :-)

Regards


Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Plugin Updates
« Reply #3093 on: June 16, 2016, 07:14:00 AM »
Hi guys,

two plugin updates:

Scales 2.0
The new version now also includes Fujita Enhanced scale and the Australian tropical cyclone classification. Big thanks goes to Gavin for his ideas and data provided.

DEMO: http://www.meteotemplate.com/template/plugins/scales/index.php

Radial Graphs 2.0
Based on your feedback I updated the recently released Radial Graphs plugin. New version includes icon tooltips to make it more clear for your users.

DEMO: http://www.meteotemplate.com/template/plugins/radialGraphs/index.php

Enjoy
Jachym

Offline Juan Maria Vilaro

  • Contributor
  • ***
  • Posts: 108
Re: Meteotemplate - new free website template
« Reply #3094 on: June 16, 2016, 09:45:57 AM »
Jachym Hello, I see that you have created two new tabs, "Meteorology and Regional" how I can create plugins to add them?

Thanks as always for your invaluable help.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3095 on: June 16, 2016, 09:47:22 AM »
Hi Juan,

look at the demo page HTML code and see if you can figure it out. I promise I will try to somehow make the menu easier for the next Meteotemplate version.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3096 on: June 16, 2016, 10:11:05 AM »
Hi guys,

I forgot mentioning I have two new regional blocks.


Forecast - Spain
I was asked if I could create a fully localized textual forecast for Spain, so here it is. It is a 2-day forecast for all the Spanish provinces.

DEMO: http://www.meteotemplate.com/template/indexBlockDemoNarrow.php?block=forecastSpain



Current Conditions - Sweden
And another regional block, this time for Sweden, which shows the current conditions for all the major Swedish cities (temperature, humidity, pressure, precipitation, wind speed and wind gust). Data is cached and can be sorted easily in the table.

DEMO: http://www.meteotemplate.com/template/indexBlockDemoNarrow.php?block=weatherSweden

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Meteotemplate - New Plugin
« Reply #3097 on: June 17, 2016, 10:39:26 AM »


New Plugin - Climate Classification

Hi guys,
I am glad that my PhD exam from climatology is successfully completed (the grade even surpassed my expectations  ) and as part of the revision I made for myself an interactive page that covered one of the chapters, in particular the one about climate classification.

I thought some of you might be interested so I made it into a plugin.

There is a brief description of the various classification schemes and then several described in detail, including images, animations, graphs, interactive calculators (find what climate type you live in based on a particular climate classification and your station data, you can also change the numbers and recalculate), maps and examples.

- Koppen’s classification scheme – description, calculator, maps, examples, past and current data in animations and pictures
- Trewartha’s classification scheme – description, calculator
- Alisov’s genetic classification scheme
- Thornthwaith’s genetic classification scheme – description, calculator

Enjoy

DEMO: http://www.meteotemplate.com/template/plugins/climateClassification/index.php

Offline jeffm5690

  • Forecaster
  • *****
  • Posts: 310
    • Long Island New York Weather
Re: Meteotemplate - new free website template
« Reply #3098 on: June 17, 2016, 01:48:23 PM »
Congratulations is in order for you on your exam!!!

Best,

Jeff

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Meteotemplate - new free website template
« Reply #3099 on: June 17, 2016, 02:03:03 PM »
Thanks Jeff,
looking for the weekend... finally I can again just relax with Meteotemplate - which is what I actually did even last weekend, but the difference being I had to try to memorize all the stuff I was doing (and much more :D)

 

anything