Extension:KML Export/How to use

The main goal of KML Export is to enable easy export of geographic data in articles to Google Earth, or any other tool that understands the KML format.

Preparing articles
The first thing you should do to see KML Export in action is to prepare articles with geographic information for KML output. This means that two things should be done:


 * 1) Call the ../kml.placemark/ parser function from somewhere in the article;
 * 2) Put it in a category of articles that contain geographic information.

The first thing, the call to ../kml.placemark/, sets a placemark with given geometry and coordinates on the current article. This call not only creates the placemark, but also links the placemark to the article it is set, so that the resulting KML file will have a hyperlink pointing back to the wiki article. The second thing, the category, is used to inform KML Export which articles should be scanned for placemarks, and also to hierarchically organize placemarks on the KML tree.

The ../kml.placemark/ call doesn't produce any output (unless for error messages), and it's syntax is not too simple, since it was designed to allow access to all parameters of the  KML tag. Since it may be convenient to produce some output to the article (stating the coordinates) and to provide some simpler interface, it is a good idea to create some wrapper templates around ../kml.placemark/. The templates should receive as input the geographic coordinates (in whatever format you may think better), convert them if necessary (using ../dms2deg/ and ../deg2dms/ functions), print the coordinates as they should appear on the article page, call ../kml.placemark/ and add the article to the appropriate category. See ../Quick start/ for examples.

Categories
There must be a root category where all articles that have KML features must be contained into. By default, this category is named Category:Articles with geographic coordinates (if your wiki is set to English, may differ in other languages). If you don't want this name, you may set it to a different name by modifying the kmlexport-root-category system message. Create this category, its text will be used as document description on the generated KML output.

Articles don't need to be directly linked to this category, they may be contained in any subcategory descendant of the root category. Category hierarchy is replicated in KML folders on the generated output, so that placemarks are organized just like articles are. Avoid putting the same article in more than one category under the root category (articles may be in more than one category, but only one of the categories should be for articles with geographic coordinates), this is important because KML doesn't support placemarks in more than one folder.

You may set styles and folder properties for categories using ../kml.style/ and ../kml.folder/. Styles set in categories become common styles, and may be used by any article contained in them, as long as that category is processed during KML output generation.

Generating KML output
KML output is generated by the ../Special:KMLExport/ special page.