a life of coding

Monday, March 20, 2006

Blending KML

Update: We're hiring python programmers to write a car navigation system in our earth rendering engine (a la Google Earth).



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.

10 Comments:

  • Awesome info! Now I just need to figure our Blender. Thanks!

    By Blogger Matt, At 3/21/06 11:11 AM  

  • I fear you, Vin.

    By Blogger peterp, At 3/22/06 3:48 PM  

  • Hi ynniv

    I have some things to understand. When you say "put the kml_export.py" you mean we have to make a .txt file with that and put in the folder you say? We have to name that file kml_export.py?

    Other issue: WHen I run the software there´s an error that says: Can´t create a new surface. Out of video memory.
    I have an Athlon 64, video on board 64 MB. I need a graphic card?

    By Anonymous Anonymous, At 4/13/06 11:24 PM  

  • anon: kml_export.py is a python script file that you need to download and place in the blender directory that contains the other blender export scripts, like 3ds_export.py. The appropriate directory for your OS should be listed above.

    I'm new to blender myself, and I can't help you with application problems. Any modern graphics card should be able to run blender, but you might not have appropriate OpenGL drivers (Microsoft doesn't like OpenGL - try installing drivers from your graphics card vendor). You will probably find better advise at the blender support forums. I recommend searching the forums before posting to them, since it is likely that many people have already had the same problem.

    By Blogger ynniv, At 4/14/06 2:55 PM  

  • I am a blender user, and now, then there is a free version of sketchup (that sadly only exports KML)I am wondering, can you try and write a script for importing KML into blender?

    By Anonymous Anonymous, At 4/28/06 6:59 AM  

  • It would be nice to be able to use this growing library of KML models in Blender. I'll take a look at importers and see what I can do.

    By Blogger ynniv, At 4/28/06 8:27 PM  

  • There is this, but it says explicitly it is not GE4-compatible (at least yet, probably meaning the latest KML 2.1 extensions):

    http://jmsoler.free.fr/didacticiel/blender/tutor/py_import_kml-kmz_en.htm

    By Anonymous Anonymous, At 7/13/06 2:44 PM  

  • Me again about XML Package missing and xml.dom.minidom

    Fixed.

    Must donwload Python, install, then copy lib/xml sub dir in .blender/scripts sub dir

    thanks

    By Anonymous Anonymous, At 9/10/07 5:14 PM  

  • In your instructions you state:
    "Put kml_export.py in your Blender scripts directory
    (windows = "c:\Program Files\Blender Foundation\Blender\.blender\scripts")
    I find it impossible to name a subdirectory ".blender" My blender installation does not have a scripts folder so I need to create this folder but I have no folders below the "Blender Foundation\Blender" level and I can't make the installation work using "blender" instead of ".blender" or skipping that level. Please help?

    By Blogger Jeannie, At 11/15/08 11:10 PM  

  • It appears that a fresh install of the latest blender (2.48a) will make the ".blender" folder in Application Settings directory of your home directory. It isn't particularly easy to access this directory, so the best way is to paste the following in to the "location" box of Explorer:

    "%USERPROFILE%\Application Data\Blender Foundation\Blender\.blender"

    "%USERPROFILE%" will expand to "C:\Documents and Settings\<Your Username>", which obviously will be different on different computers.

    By Blogger ynniv, At 12/11/08 11:21 AM  

Post a Comment



<$I18N$LinksToThisPost>:

Create a Link

<< Home