Google Earth vs. Reality: The Tutorial

Jason recently blogged about a new hobby — comparing photographs of physical locations to their renderings in Google Earth. I had nothing better to do tonight, so I decided to try it out myself. Instead of switching back and forth between a photo and Google Earth, I wanted to find a way to overlay an image on the program while I navigated Google’s vision of Earth. Jason suggested this may be possible using KML, but I wanted to just whip up something quickly, and didn’t feel like learning a new markup language tonight. I remembered reading about a hack that lets you keep Dashboard widgets persistent in floating windows as you work in other applications, so I decided to look for a solution using that.

The funny thing is, I’ve never written a Dashboard widget before. But I’ll tell you right now: I created what I wanted in five minutes using Dashcode, without ever launching the application before or writing a single line of code. Here’s how I did it:

  1. Open Terminal and type (or paste) the following command, which enables the hack, and then hit Enter:
    defaults write com.apple.dashboard devmode YES
  2. Restart the Dock by running this command:
    killall Dock
  3. Open Dashcode. If it’s not on your computer, look for the Developer Tools disk that came with your Mac or copy of OS X.
  4. It will ask you to choose a template. Choose Custom.
  5. Select the background image and “Hello, World!” text in the template and hit the delete key to remove them.
  6. You’ll probably want to look at your photo a little larger, so expand the size of the widget by grabbing the bottom-right corner of the checkered area and dragging it to a reasonable size.
  7. Drag your real-world image onto the checkered area. I found three ways to do this:
    If your photo is in your iPhoto library:
    Click the Library button in the upper-right corner of the window, then choose the Photos tab. Drag and drop.
    If your photo is already open somewhere or you see the file in Finder:
    Drag it directly from Finder or the other application onto the checkered area. If it’s open in another application, try dragging the file name directly from the title bar. Neat, huh?
    If your photo is hidden somewhere:
    Choose Add File… from the File menu, and navigate to the photo that way. It will appear in the Files listing in the bottom-left corner of Dashcode, and you can drag it from there.
  8. Resize your image as necessary, and place it wherever you want in the checkered canvas, which will be the visible area of the widget. If you want to make sure it’s displayed at its original resolution, click on it once and then click on the Inspector button. You can change the dimensions under the metrics tab (ruler icon).
  9. Using the same Inspector window (I seriously love apps which use the Inspector, especially if it’s my first time using them), open the Fill & Stroke tab (rectangle/circle icon) and adjust the opacity to something less than 100%, so you’ll be able to see the Google Earth image under yours.
  10. In the File menu, choose Deploy Widget to Dashboard… and give it a name. Click Deply.
  11. Dashboard will launch and ask if you want to install the widget. Click Install.
  12. Dasboard will then ask you if you want to keep the very widget that you just installed a second ago. Click Keep.
  13. Finally, you can take advantage of the hack we did in step 1. Click and drag on your new widget, just so that you move it a little. Then, while still holding the mouse button down, press F12 to exit Dashboard. Your photo will remain as a translucent floating image, allowing you to work with other applications under it (as long as you don’t click directly on the image).
  14. After you’ve lined everything up in Google Earth and want to get rid of the image, click and drag on the image, and again while still holding down the mouse, press F12 to re-engage Dashboard. It will then disappear when you exit Dashboard.

I don’t know how you want to present your final comparisons, so I’ll leave that up to you. You could just take a screenshot of the whole deal if you want a transparent overlay, or you could line them up Jason-style for side-by-side comparisons. You may also notice that my widget is pretty primitive… but as I wrote earlier, it was my first time making one and I was able to do it without writing any code. Maybe someday I’ll work on one that allows you to change the photo directly from the widget. For now, you can just change the photo in Dashcode and redeploy. If you keep the same name, Dashboard should recognize it as the same widget and ask if you want to replace it.

As Jason suggested to me, if you already have your photo geotagged, that gives you a great starting point in Google Earth. I did some geotagging on Flickr a few years ago (I’m still working on updating my Picasa Web Albums data), so I thought it pretty easy for me to find something to get started with. However, I found I didn’t have very many geotagged photos of landscapes, so my options would be limited to comparing photographs to data on the 3D buildings layer (too bad I don’t have digital shots from Disney World) or Street View. I’ll have to take a closer look at my photo library and show you if I find anything cool.

Once you find out exactly where a photo should be placed, you can easily stick it into Google Earth using this software, which will generate the KML file for you.

As usual, when I talk tech please remember my disclaimer.

Leave a Reply

Your email address will not be published. Required fields are marked *