Taking Snapshot of Google Map
Wednesday, August 29th, 2007My boss is great fan of google map geographical visitors of our website, and he wants to show it in the main page. I was bit worried about the delay caused by the javascript making the overlay on the map. So I decided to taking a snapshot of it and use it for the main page.
First, I didn’t want inventing a wheel, so I tried to use webkit2png. Obviously, I was asked to install PyObjcC, but it wasn’t easy to install in my machine (WebKit problem). I’ve installed Safari beta 3, and some people blamed it as it pretends having WebKit SDK while it doesn’t. But changing symbolic links for WebKit SDK didn’t work.
So, I’ve shifted my gear and thought. What if using AppleScript and Paparazzi? I’m totally newbie in AppleScript world, so I’ve looked for what others have done. Galarrhea is an AppleScript making a snapshot of each of your Ma.gnolia and del.icio.us bookmarks using Paparazzi.
Base of what he have done, I was able to capture the geographical visitor page, and I used ImageMagick to cut off the google map region from the big-fat-page image. And I also used scp to upload the snapshot to the server. I considered exploiting Transmit with AppleScript, but my server is over the firewall, and I need to use SSH Tunneling to go through it directly, so I decided to stick with a shell script.
Here’s the script. geovisitors.scpt