Projects/KML Export/Manual/Quick start

From juliano.info

Jump to: navigation, search

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

Contents

Necessary templates

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}}}}}
<includeonly>{{#kml.placemark:Point({{{1|0}}},{{{2|0}}})|{{{3|}}}}}
[[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:

<includeonly>{{GeoDeg|{{
#lat_dms2deg:{{{1|0}}}|{{{2|0}}}|{{{3|0}}}|{{{4|0}}}}}|{{
#long_dms2deg:{{{5|0}}}|{{{6|0}}}|{{{7|0}}}|{{{8|0}}}}}|{{{9|}}}
}}</includeonly>

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

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

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:

{{GeoDMS|22|57|5|S|43|12|39|W}}

Generating KML from articles

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.

Views