Infographic: last.fm Events in Berlin
The inforgraphic of "last.fm events in Berlin" shows the locations of the events in Berlin on a map. Besides, it illustrates the attraction points in the city through event spheres in different colors and diameters according to shouts and attendees.
The purpose of the infographic is to picture the current urban concentration areas by filtering online data on last.fm.
The script takes last.fm events from berlin and displays them as 3D spheres hovering over a map of Berlin.
At first, the script reads a page from last.fm using the getEvents function from the API.
But there are only 10 events on each page, so it reads the number of pages and goes on loading the other pages until the last. Each page is read as XML.
For each event, the script takes the following data and puts them into arrays: longitude, latitude,number of attendance, date.
To get the number of shouts of an event, for each event, another function from the API is used: getShouts, and the number of shouts is also put into an array.
Then, it finds the maximum and minumum of longitude and latitude, which is the extent of the events on the earth surface.
It then connects to Yahoo API and loads a fitting map. The colors of the small streets and the background in the map are removed and converted it to black and white.
Longitude and Latitude for the events are calculated to the appropriate screen coordinates.
The diameter of the spheres is half the number of attendees.
The color of the spheres has to do with the number of shouts: if there are 0 shouts it is grey, some shouts blue,
and if there are more scouts than half the number of attendees, then it is red.
In the draw function, for each event a sphere is drawn over the map.
Spheres are transparent, and there is also a line connecting the sphere to the place on the map. Peasycam is used to show it in 3D.