Making the globe in FixPlanetEarth

date: March 25th, 2011

It has been a while since I've published my last post. To be honest I just been unbelievable busy and I didn't have much spare time for making new experiments; those I do for fun with no pressure, no rush.

Couple of weeks ago, by chance I read some articles (from different sources) about global warming, overpopulation, worldwide resources, world's education and that entire thing you might have heard already about humans destroying the planet slowly. I know that you may be feeling a bit tired about this subject but I was actually thinking what if you have a real chance of making instant-huge changes on earth, what would you do?

So, in one afternoon during my coffee break, I wrote down an email with some specific key questions and I sent it to some friends around the world (thanks everybody for the well detailed answers), these answers gave me a good idea about what kind of resources-tools we could use for making quick-drastic changes on Earth so I built up a Flash interface with the idea. I have published the whole thing on facebook but it is also available here (both use same database)

http://www.yoambulante.com/en/labs/FixPlanetEarth/

Fix Planet Earth


The technical part

Well, it is all about Flash and using some resources only available on Flash player 10 like its drawing API; copyPixels, drawTriangles, blending modes, etc. It is a bit interesting, this app didn't take me long, I did the whole thing from scratch in just few days. It took me exactly 9 days working at nights, it definitely looks more complicated of what it actually is. I think it could be a good practice for the people who are interested to know how it was made. This is a very simple program, it is pure actionscript without using extra libraries or extra resources (I am not using any 3D Engine), it is just actionscript with some good magic bits of bitmap data manipulation (the performance of the app when rollover the countries on a 3d projections was a good challenge).

I am currently thinking in writing an article explaining it step by step divided by days. You might wonder where I got all the data from, textures, countries data, filters, etc, and the answer is simple; Wikipedia. Did you know that Wikipedia has an API which you can use from Flash and extract any kind of data you want?

I have extracted automatically all data I needed in my app from Wikipedia, including the countries coordinates, capital, globe coordinates in degrees (latitude and longitude), mouse rollover sectors, highlights; i.e. this piece of code extracts from Wikipedia the string where the capital name of a country localized:

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onCountryData);
var country:String = "France";
loader.load(new URLRequest("http://en.wikipedia.org/w/api.php?action=query&titles=" + country + "&prop=revisions&rvprop=content&rvlimit=1"));

function onCountryData(e:Event):void {
var data:String = loader.data;
var found:int = data.indexOf("|capital");
if (found > 0){
//shows the string where the capital is
trace(data.substring(found+9,data.indexOf("\n",found)));
} else {
trace("capital not found :(");
}
}

Unfortunately, I ran out of time, this is all what I can say so far, I will write down an article explaining it bit by bit (I soon as I have the chance) it was a very interesting practice for me.

Cheers guys!


date: 03 Mar 2012 - 17:29:19, published by Liam
I'm a firein mah Lazer