It struck me the other day that Google Earth would be good platform for sharing my data with other people and found out that lots of people display their own data on the platform. Google even has a website to distribute Google Earth files that they like (this one, of the world population, was one of my favorites).
So then I looked around to see if anyone had written code to help people convert Matlab data into Google Earth files. The Google Earth Toolbox (recommended by my colleague Amir) worked great. It allows you to display data using functions very similar to standard Matlab functions (eg. imagesc()) only the output image is projected onto the planet and can be explored using Google Earth. The image above is a map of the tropical cyclone climatology that I imported to Google Earth with only two lines of code.
A = ge_imagesc(LON, LAT, flipud(DATA));
[As indicated, the only bug I found was that some of the functions flipped the data vertically, which is easy to fix with one usage of the function flipud().]
It seems to me that one huge advantage of this presentation method is that pretty much anybody can view and explore global data-sets, since the interface is entirely intuitive and requires no manipulation (similar, in many respects to the contribution of Gapminder).
With a little extra work, I made the data-set dynamic in Google Earth, so that users can view data from different dates using a slider (see code below), and made this movie for use in presentations:
Below the fold is the script I used to make a Google Earth data set that changes over time. Making the movie above required two additional steps.
- Add a "Tour" in Google Earth (under "Add") which just records your browsing of your data in a movie that plays back in the Google Earth Application.
- Use a screen capture program to record that movie as it plays back. (My friend Pam recommended this screen capture software, which works nicely and is easy to use).
%Use Google's date format:
S = 'yyyy-mm-ddTHH:MM:SSZ';
lon = LON_DATA;
lat = LAT_DATA;
kmlstring = '';
for t = 1:NUMBER_YEARS
% my data spans 59 years, and is just annual; higher temporal resolutions will require a bit more effort
starting = datestr(['01/01/' num2str(t-1+STARTING_YEAR)], S);
ending = datestr(['12/31/' num2str(t-1+STARTING_YEAR)], S);
kmlstring = [kmlstring, ge_imagesc(lon,lat,flipud(DATA(:,:,t)),'name',['data_name ' num2str(t-1+1950)], 'imgURL', ['./GE_images/' num2str(t-1+1950)], 'timeSpanStart',starting,'timeSpanStop',ending)];
f_maxs = ge_folder('FOLDER_TITLE', kmlstring);
%I think if you change the file name to be ".kmz" it will zip it into one file for you. I just ran this and saved it from google earth into a .kmz file.