Visualizing Energy Usage and Consumption of the World William Liew Abstract As the world becomes more and more environmentally aware, a simple layman s visualization of worldwide energy use is needed to inform the public quickly and efficiently about worldwide energy use. This paper describes how this program efficiently and effectively represents energy usage around the world. I. Introduction The modern world cannot function without energy. It is easy to assume energy demand is growing rapidly, but how quickly and in which areas. As energy usage increases, it is important for this fact to be able to be communicated quickly and effectively. This project allows user to see which nations are growing quickly (energy usage wise) and which nations are stagnant. Being able to see where there is the most growth is crucial to understanding how to regulate supply for the constant demand of energy. This paper presents a way to effectively demonstrate where in the world energy demand will be the highest. It also presents an easy way to show en ergy usage growth in each nation. Although the data of energy usage is readily available, the human mind really is not meant to handle large numbers (i.e. any numbers greater than 100), this means although the data is available, the scale of the number is lost in transition. The program described will not only show exactly how much energy is used, but does it in a simple manner in which human can interpret it quickly. The project projects Earth onto the screen, with each country floating on top of the sphere. The farther away the country is from the globe, the more energy the country use. A color is also mapped onto the country based on energy usage. The most similar method I found actually exists on http://enerdata.org, which is the source of my energy usage data. The website displays its energy data through a world map using a color-map. Although it is quick and effective, I believe color-maps are not instantaneous enough for human comprehension. Wikipedia and Google also provide energy usage information; however neither has a visual representation of the data. I did not find any other well-known provider of global energy usage data. Although the US census provides data of the United States, it does not provide any data for other nations.
II. Technical Detail OpenGL in C++ is the main display tool used due to my familiarity to it. Several short Java programs were created to find or parse data. The energy usage data is retrieved from http://enerdata.org as a Microsoft Excel sheet exported into a CSV file. Although the excel sheet contains many other data (such as energy from coal), only total Energy Usage was considered. All of the energy data was recorded with the unit: mtoe, or Metric Ton Oil Equivalent. The data recorded energy data from 1990 to 2010, each neatly aligned with its respective nation. However, to display this data in the format I wanted, I needed to be able to find out where each country is. At first I considered using GLUT to draw a sphere, apply texture map to represent the Earth, then using a Web API, find out where each nation is, then using a shader to transform the sphere. This was highly ineffective. Not only was texture mapping a sphere difficult, often came with obscure results, but finding out a position relative to the texture was even worse. I decided not to use the GLUT default sphere. A more accurate way to draw Earth was to use longitude and latitude data to draw Earth. A formula is used to convert longitude (ranging from -180 to 180) and latitude (-90 to 90) into an X, Y, and Z coordinate that can be used to display onto the screen. This means I could easily draw a sphere, but also just as easily locate a specific coordinate. The Algorithm is as followed: (R represents radius of the sphere) LAT = latitude * pi/180
LON = longitude * pi/180 x = -R * cos(lat) * cos(lon) y = R * sin(lat) z = R * cos(lat) * sin(lon) However, I still needed data on where each country is. At first I wanted to do this manually, however, if I use each integer as a data point, this would take me 64,800 checks. I decided to see if I could parse this data with my program. I found a C++ library called libcurl which would allow me to download data from a URL. I used an API for reverse-geocoding from http://geonames.org. The API allows me to see what country exist at a specific coordinate and returns a 2-character ISO Country Code. The API was not only very easy to use, but provided exactly what I needed. Then disaster struck. Although the API interface was fantastic and very easy to use, it only allowed a certain number of lookups every hour. It also performed very slowly, thus a real-time look up of 64,800 coordinates was just not practical. Thus, I had to create a file with all the data. I decided not to use the libcurl library and instead used the URL parser from Java.net library. The Java program was called Reverse Geocode, it looked up all 64,800 coordinates and then records the coordinates which returns the ISO Country Code. Due to the hourly limit of lookups, Reverse
Geocode left out many segments. Thus Reverse Geocode was manually tuned many times to lookup the missing segments of the world. It took a while but finally I have a complete set of world country data for my program to use. Figure 1: Segmented Incomplete Map Data I recorded all ISO Country Code in a 2D Array sized 360 by 180. Although this was not memory efficient, it was the quickest way to do it. It also allowed lookups to be done very quickly, thus the program can run more quickly in real-time. The program records any coordinate with a Country Code as landmass. After the program stores all Energy Data with their respective nation, it inputs it into 2 sets of arrays, one for the ISO Country Code, and the second for the list of yearly data. The program compares these country codes with the map data, locates the ones that are on the Energy Data, and draws them with different parameters.
A point and three of its neighbors is taken to create a polygon (after transforming it from longitude/ latitude algorithm to XYZ-coordinates). This is repeated until an entire sphere is created. For countries which do have an energy usage data, the radius of the sphere they re projected on is increased, based on the value of the energy usage. This means every layer of energy value is on its own sphere. This makes the map look much cleaner. I included a few more features other than just looking at the globe. First I decided to create a map view; this made it simpler to look at all the energy data as a whole. This is done by using longitude and latitude as X-coordinate and Y-coordinate. I also decided to include a scaling option, so that energy usage of smaller nations can become more apparent (relative to other small nations). I made sure countries without data was still displayed on the map so that the geographic importance of the globe is not lost. In the end the program takes two files, a map file (included as country.txt ) and a formatted CSV data. III. Results The result of the visualization was spectacular. Not only could I tell which countries had the most energy growth by stepping through the years, but I can also see which region of the world that grew similarly. Coupled with the knowledge of historical significance of the years, I was actually surprised at some of the findings from this visualization. One of the more obvious facts is that China had the most growth. In the 1990s its energy usage was much lower than that of a normal, developed nation. Factoring its massive population, one can tell that China did not start as prosperous as other nations. However, stepping from 1990 to 2010 reveals that China s energy spending grew rapidly. As Chinese population moved from rural to urban areas, energy usage shot up, eventually overtaking the United States as the nation with the highest energy usage. It should also be mentioned that India is also seeing quick growth in energy usage. Another interesting fact was that Russian energy usage declined and then increased. It was actually one of the only nations in the world with an energy decline. It also saw one of the most massive energy declines in that of any nation. This is most likely due to the fall of the Berlin wall, which occurred in 1989, which caused Russia to fall into a state of economic recession and chaos for the next decade. This explains why Russian energy use started growing at a steady rate again after 2000. A surprising fact I found was that the energy usage of the United States grew very slowly. In 20 years, the total energy use is very low. This means either the United States energy growth is either stagnant, or that the United States is becoming more efficient. Europe actually uses very little energy per country. This surprises me because it seems energy usage and economy seems to be strongly correlated. Germany has one of the strongest economies in the world; yet, the energy usage in Germany does not even come close to that of Russia, US, and China. My guess is that developing country with high population will tend to have explosive energy usage growth.
A very disappointing fact was that because the energy usage between super-power nations (i.e. Russia, United States, and China) far out used any other nations. This makes it very difficult to differentiate energy usage of smaller nations. However, the resolution method makes the energy usage easier to differentiate. I was also disappointed that the dataset from enerdata.org was not as large as I liked. There were only about 40-50 nations with recorded data, with India missing data from 2010. IV. Conclusion The visualization came out generally how I envisioned it. I thought I would have to compromise and not be able to raise the borders of each nation. However, because of the geoname.org API I found, I could have an accurate map that can be swapped between countries. Given more time I would like to have found a better way to import map data. On geoname.org it was actually possible to download the dataset they used, however, I did not research enough on how to parse that data into the useful format I needed it to be. Another feature I would have added is the ability to read in XML files for Country Data. That would give me more data about each nation (full name, which continent the country exist in, etc). This will allow me to display continental energy usage, which was provided in the dataset. Being able to parse XML file easily would also allow me to take data from multiple sources, including Wikipedia. I really wish I had time to gather the data for population from 1990 to 2010. This will allow me to see energy usage per capita rather than just total energy usage. This might even mean that the United States, due to population rising faster than energy usage, is actually lowering energy usage per capita each yeah. It might also mean the smaller European nations will show signs of growth that is otherwise overshadowed by the huge total usage from the superpower nations. I have no doubt both China and India will still show rapid growth per capita, but their current energy usage per capita will still be much lower than that of United States. References [1] Enerdata.org. The main data used in each individual country data. Available from http://enerdata.org [2] Geonames.org. Used to parse country data to show the globe, available from http://geonames.org