ynniv.com

a life of coding: Blending KML

  • ️Tue Mar 21 2006


Google is the best thing that's happened to Keyhole. They've transformed a cool visual toy into a platform for GIS information, and the key to their success is twofold. First is the open KML (XML) file format - anyone can make simple content. Second, Google Earth is free for limited use. The combination is magic - developers are eager to create content, consumers are eager to view this content, and Google gets rapid desktop application adoption and the ability to roll out future advertising.

The KML format is easy enough to read and write by hand for small amounts of meaningful data, like placemarkers and pointers to raster files for ground overlays. What's currently lacking is a free way to convert lots and lots of meaningless data, like 3d models. There are a few commercial tools out there, most notably SketchUp (recently purchased by Google, 8 hour trial available), but nothing free for the casual hacker... until now.

kml_export.py is a python script for blender that supports meshes and diffuse lighting. Not much, I know, but KML doesn't support much 3d. This is really a quick-release, rough cut, leaves much to be desired release - but it gets the job done.

Installation:

  1. Put kml_export.py in your Blender scripts directory
    (windows = "c:\Program Files\Blender Foundation\Blender\.blender\scripts",
    mac = "/Applications/Blender/blender.app/Contents/MacOS/.blender/scripts",
    linux = "~/.blender/scripts"?)
  2. Edit kml_export.py to adjust the placement constants (lat, lon, altitude, scale)
  3. If you're using Windows, you'll need to download PyXML. Unarchive the PyXML folder and move the "xml" subdirectory to the same folder as kml_export.py.

Your scene needs to contain at least one mesh object to produce useful output.