Extension:KML Export/Quick start

From MediaWiki.org
Jump to navigation Jump to search

This page describes how to set up KML Export quickly after installed. For more detailed instructions, check How to use.

Necessary templates[edit]

To make it convenient for your users to set placemarks, you may create templates that call the proper parser functions.

Create a template named [[Template:GeoDeg]], with the following content:

Coordinates: {{#lat_deg2dms:{{{1|0}}}}} {{#long_deg2dms:{{{2|0}}}}}
[[Category:Articles with geographic coordinates]]</includeonly>

This template calls the kml.placemark parser function to set a placemark pointing to the location given by the first two parameters (latitude and longitude in decimal degrees). The placemark is linked to the article this template is instantiated from. Note that the function call and the category link are between <includeonly>...</includeonly> tags, so that the template itself doesn't get added to the category and doesn't set any placemark.

Now create a template named [[Template:GeoDMS]], with the following content:


This template provides a more user-friendly interface to the first one, allowing the user to provide coordinates in the usual degrees-minutes-seconds notation. The first four parameters are degrees, minutes, seconds and hemisphere for latitude; the following four parameters are the same for longitude. To call this template, e.g., 22° 57′ 5″ S 43° 12′ 39″ W becomes {{GeoDMS|22|57|5|S|43|12|39|W}}

Setting a category for articles with coordinates[edit]

As you could have noticed from the above templates, they insert the articles they are used into a category named [[Category:Articles with geographic coordinates]]. Create this category and put some content in it. This category should have this exact name unless you change kmlexport-root-category system message.

Marking articles[edit]

To set placemarks, put calls to the above templates in some articles. As an example, an article about the Christ the Redeemer may have the following template call:


Generating KML from articles[edit]

Now, to see the extension in action, navigate to the [[Special:KMLExport]] special page. Since it is not listed in [[Special:Specialpages]], you will have to type its address in the address bar of your browser. If everything is ok, you should be prompted to open or save the file. Open it with Google Earth and you should see the placemarks you set.