Google Earth
Change language:

Validating KML As You Go

To use some of KML's more advanced features (such as, Region, TimeSpan/TimeStamp, and ScreenOverlay), you must author the KML directly in a text editor. Whereas you can use a basic text editor, such as Notepad (Windows) or TextEdit (Mac OS X), they don't provide any error-checking. This means that you won't discover mistakes until you try to open the file in Google Earth, and recieve a parse error.

jEdit is an open-source, Java-based text editor that works on Windows, Mac OS X, and Linux. Using a few additional plug-ins, jEdit provides as-you-type error checking to ensure that your KML is well-formed and validates against the official KML schema. You can also use the Super Abbreviations plugin to quickly insert snippets of KML. This tutorial will show you how to set-up jEdit for editing KML, demonstrate some of its error-checking abilities, and show you how to use the KML abbreviations.

Before You Start

  1. Install the Java Runtime Environment.

    Go to http://www.java.com and click Free Java Download.

  2. Install the latest development version of jEdit.

    Go to http://www.jedit.org and click Download link at the upper right. Be sure to install the latest version which is 4.3pre16 as of this writing. Do not download the stable version (4.2) which is fairly old.

    Recommendation:
    During the installation process you should uncheck the "Start jEdit Server automatically on system startup" option. This feature isn't required, and unseleting it will prevent unnecessary programs from starting up on your computer.

  3. Download abbreviations file.

    download kml kml_superabbrevs.txt: jEdit Super Abbreviations for KML

The following videos show you how to set up jEdit plug-ins to work with XML files and how to properly reference the OGC KML 2.2 schema, so that your documents are validated as you type.

Setting up jEdit Plugins to Validate KML (video)


Install jEdit:
  1. In jEdit, click on the Plugins menu > Plugins Manager
  2. Click on the Install tab of the Plugins Manager window
  3. Select the following plugins:
    • XML (Note: jEdit will automatically select these other associated plugins: XercesPlugin, SideKick, and ErrorList and Beauty)
    • SuperAbbrevs

  4. Click the Install button, and when complete, click the Close button
    Note: If the plugin download is slow or does not progress follow these steps: 1) Stop the download; 2) Click the Download Options button; 3) Click on Update Mirror List; 4) Choose a geographic location close to you; 5) Click OK; 5) Repeat the steps above to select and install the plugins.
Configure plugins:
  1. Click the Plugins menu > Plugins Options
  2. Click and expand the SideKick plugin folder in the list on the left
    • Select General underneath SideKick
    • Under Auto parse Settings, check Parse on buffer save
    • Check Parse on keystroke
    • Adjust the slider After last keystroke, wait (seconds) to 1 second. Adjust this later to change the amount of time jEdit waits after you finish typing to check the KML file for errors.
  3. Click and expand the ErrorList plugin folder in the list on the left
    • Check Automatically display on error
    • Check Auto-close on no errors
    • Check Auto-refocus on Text Area
    • Check Show error icons in the gutter
  4. Click and expand the SuperAbbrevs plugin folder in the list on the left
    • Select Abbreviations under SuperAbbrevs
    • Using the Select Mode pull-down menu, select XML.
    • Click the Import normal abbrevs button at the lower right
    • Click on the import abbrevs button, which is the fourth button, near the plus (+), minus (-) and settings (wrench icon) buttons.
      Note:
      In jEdit 4.3pre16, the import abbrevs button may be invisible, but isstill clickalbe. If you don't see a fourth button to the right of the others, place the mouse over the center of the Edit Abbreviation button (looks like a wrench on a piece of paper, and may be ghosted out). Move the mouse of horizontally the right until a small gray square appears under the mouse, and then click. This is shown in the video.
    • In the Open dialog window, navigate to where you saved the kml_superabbrex.txt file. Select it and open.

  5. Click OK on the Plugin Options window.
Dock plugins to side and bottom on jEdit:
  1. Click the Plugins menu > ErrorList > Error List
    • Click on the small, black, downward pointing arrow at the upper left of the Error List window that appears.
    • Choose Dock at Bottom
    • The docked Error List window pane can be expanded or collapsed by click the Error List button at the button.
  2. Click the Plugins menu > SideKick > SideKick
    • Chose the small black arrow, and choose Dock at Left.
    • The docked SideKick window pane can also be toggled by clicking the SideKick button at the left.
Create a keyboard shortcut for SupperAbbrevs:
  1. Click the Utilities menu > Global Options
  2. Click on the Shortcuts option in the list on the left, underneath the jEdit folder.
  3. Select Plugins: SupperAbbrevs from the Edit Shortcuts pull-down menu at the top.
  4. Double-click the "Primary Shortcut" cell next to the "Show expansion dialog" command in the list.
  5. Create a key shortcut. I use Control-Enter (Command-Enter on Macs)
    Note: Control-Enter may already be used by the Action Bar command. You can override this shortcut asssignment.
  6. Click OK.

Error checking KML with jEdit and using Super Abbreviations (video)


demfds
sadf

 

Discussion / Feedback

Have questions about this tutorial? Want to give us some feedback? Visit the Google Earth Outreach Discussion Group to discuss it with others.

What's Next?

Want to test out your new skills? Check out these other tutorials that require some hand-editing of KML: