Howdy, everyone! I'm sure that after reading countless posts on the Geo Developers blog and writing tons of code using Google Geo APIs and other development kits, you're all experts with KML. I mean, you obviously know that to create a polygon, you simply need a <Placemark>, with a <Polygon> containing an <outerBoundaryIs> consisting of a <LinearRing> with a <coordinates> element which contains a series of (longitude, latitude, altitude) tuples... and, you didn't forget that you need to repeat your first coordinate tuple again at the end, right? Heh, well maybe not. For those of you can recite the entire OGC KML v2.2 schema from memory in one go, you can probably stop reading.

To the 99.9% of us who don't know everything there is to know about KML, and have been looking for a way to explore this curious little language, I present a new learning and exploration tool called the KML Interactive Sampler. One caveat, though -- since the sampler uses the Earth Browser Plug-in and API, the Earth view will currently only work on Windows.

Mac folks... be patient, a seriously awesome Mac version of the plugin is in the works!

Here are a few screenshots of the sampler to whet your appetite:

KML Interactive Sampler Screenshot 1 KML Interactive Sampler Screenshot 2 KML Interactive Sampler Screenshot 3

The sampler consists of a four important sections:
  1. The sample list on the left contains a variety of predefined KML samples, organized hierarchically by topic (i.e. 'Lines and Paths', 'Polygons', etc.) Clicking a sample in the list will load the KML contents into the editor and display the KML in the Earth preview window (see below).
  2. The instructions and useful links panel at the top contains instructions and other miscellaneous information about the currently loaded sample, as well as relevant links to the KML reference.
  3. The source editor is the highlight of the sampler. Here, you can make local changes to the sample code and see how the new code looks in the Earth preview by clicking the 'Update Earth' button. And, you can even start a new KML document from scratch once you're ready. The editor has built-in syntax highlighting, so you'll be visually warned if you have an incorrect end tag somewhere. Many thanks to the developer(s) of CodeMirror for the outstanding text editor component.
  4. And finally, the Earth preview, is an instance of the Google Earth Browser Plug-in that shows you the hard-earned results of your KML code.

So, if you're just starting out with KML, or brushing up on your existing skills or maybe just looking to play around with a cool new toy, definitely check out the new sampler. If you have any trouble using it, feel free to comment in the Getting Started with KML support forum.

Thanks, and enjoy!