Clear questions and runnable code
get the best and fastest answer
Google Earth Monksby McDarren (Abbot)
|on Jul 02, 2006 at 12:27 UTC||Need Help??|
Over the past week or so, I've been playing around with Google Earth. Very very cool stuff.
Anyway, I thought it would be kinda neat to put Perlmonks on Google Earth, in a similar way that jcwren did with the Big Monk Map, and theorbtwo did with pmplanet. So I hacked together a script to pull the monk location data from tinymicros, and then pull in the other basic Monk data (such as XP level, date joined, number of writeups) from Perlmonks.
The end result is a
At the moment it's fairly rudimentary, with Monks ascii-betically grouped into folders. Clicking on any single monk name brings up some basic info about that monk, and double-clicking zooms to their location (all standard Google Earth behaviour). I did manage to find a rather cute little "monk" to use as an icon for the placemarks :)
I'm a little bit hesitant to post the code I used, mainly because when run it will hit Perlmonks about 800 times, to gather the monk stats. And I don't think we'd suddenly want to have dozens of people doing that ;)
But basically, the code does the following:
I used Storable to save the data to disk, so that I could re-use the data on subsequent runs (whilst tweaking the script), and not have to continually scrape the data over and over again. This means that the data is already out of date - but shrug, at this stage it's just an exercise for a bit of fun and learning :)
The other thing that occurred to me is that something like this would probably be better integrated into jcwren's existing pmstats at tinymicros - especially as he is already pulling the required data on a daily basis.
It's also possible that somebody has already done this, and so I may have just re-invented another wheel. Although if they have - I couldn't find it.
So for now I just thought I'd throw this out there, and see what the reaction is.
Update 1. (2006-07-04): - I've discussed this with jcwren this morning, and he has supplied me with an XML feed directly from tinymicros for all this data (on a single page). So once I have the time (over the next few days), I'll provide a link to a daily updated KML file. Stay tuned! :)
Update 2. (2006-07-06): - Made a few changes over the past few days as follows:
Update 3. (2006-07-10): - This now has a "permanent" home. Two files are generated each day, and there are also a few screenshots.
Update 4. (2006-07-11): - The code.