Go48builds
Posts: 2
Joined: Wed Feb 11, 2015 8:23 pm

Pull data from a website and Graphicly display it

Wed Feb 11, 2015 8:34 pm

Hello everyone,

So I wanted to make a weather station but I realised buying all those sensors would cost me alot of money even more if I wanted
to place them in multiple locations in my country. So I figured I could pull the date from the Belgium (my country) agency that does this research. (This is the website (it is dutch) and I am talking about that table with all the numbers :p : http://www.meteo.be/meteo/view/nl/12338 ... ingen.html )

So I did some googling and saw that I could import data from a website to excel, but this only worked for "supported" tables I guess since it didnt work for me. Anyway that got me back to square 1.

So what I am asking is:
How do I pull the weather data from this site and get it into a graphic interface on my raspberry pi. Graphic interface: The map of belgium with the weather stations displayed on them and all their data. (so not a plain excel file with some numbers)

Thanks for reading and I hope you can help me!

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Pull data from a website and Graphicly display it

Thu Feb 12, 2015 12:18 pm

Hi, Parsing webpages can be a bit problematic since if the web developer changes the format, you have to re-write your code.

There are sources of weather data online like http://openweathermap.org/api that provide the weather data in a computer friendly format that you can then display.

For example
http://api.openweathermap.org/data/2.5/ ... =London,uk
Will give you the current weather for longdon in a JSON format.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

southpaw
Posts: 52
Joined: Wed Nov 30, 2011 2:23 pm

Re: Pull data from a website and Graphicly display it

Thu Feb 12, 2015 9:12 pm

this guy did something similar using "pygame"
plenty of helpful pointers in his thread
http://www.raspberrypi.org/forums/viewt ... 41&t=51807

Go48builds
Posts: 2
Joined: Wed Feb 11, 2015 8:23 pm

Re: Pull data from a website and Graphicly display it

Fri Feb 13, 2015 11:51 am

scotty101 wrote:Hi, Parsing webpages can be a bit problematic since if the web developer changes the format, you have to re-write your code.

There are sources of weather data online like http://openweathermap.org/api that provide the weather data in a computer friendly format that you can then display.

For example
http://api.openweathermap.org/data/2.5/ ... =London,uk
Will give you the current weather for longdon in a JSON format.
Thanks, I have never worked with Api's before how do you integrate them with python, do you know some extensive guides to get me started?

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Pull data from a website and Graphicly display it

Fri Feb 13, 2015 12:47 pm

It just so happens that I created something in python (AGES AGO!!) to do just this. It was written for Python 2 but should be 2to3 convertible without too many problems.

Its on my github python project repository https://github.com/scotty3785/python/bl ... her_get.py

This example gets the current weather and stores it to a log file, it then uses any previously stored data to compare whether the temperature has changed and by how much.

There are some more extensive example on the open weather page http://openweathermap.org/examples

It even includes a Raspberry Pi example for a weather station https://github.com/DzikuVx/WeatherStation
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Return to “Automation, sensing and robotics”