Extension:Semantic Google Maps

This is a proposal for a semantic approach to including maps in MediaWiki. Semantics add great value to MediaWiki as it drastically improves both human and machine usability and readability of information.

=Background=

What are semantics?
You can find more information about semantics at ontoworld.org.

Other Map Extensions
Most other extensions that integrate (Google) maps into MediaWiki create a tag. By including this tag, a map is included in a page. The geographic coordinates are given within the tag and are onlu used for including the map. Additionally functionality like creating GeoRSS feeds works by searching articles in a specific category, looking for the map-tag within articles and extracting geographic coordinates from that tag.

An example of this kind of approach is the excellent Extension:GeoRSS. There are a few disadvantages to this approach though. The tag in this extension is not available in the source, the map is always included in the same way, the map can not be included in the template, the coordinates are not easily available to other extensions, the coordinates are not visible in the page, search machines have no way of indexing the locations.

Semantic Map Extension
The semantic approach does not introduce yet another tag for including a map. It produces as little extra code as possible and leans heavily upon Semantic MediaWiki and Semantic Forms. Semantic MediaWiki offers a way of intelligently storing and displaying geographic coordinates. Semantic Forms offers a user friendly way of adding and editing semantically stored data.

Google Maps Semantic provides a way of including a map in any page that includes semantic coordinates. This map is defined in the template page of the semantic template that the coordinates are part of. Currently this can only be done by a parser extension, because parser extensions can take template-variables as input.

On the other hand Google Maps Semantic provides a way of adding and editing coordinates to an article by simply clicking in a map. This is done by defining an extra input-type for the Semantic Forms extension that displays a map that feeds the coordinates to the form-field when it is clicked upon.

=Implementation=

Insert Map
To include a map in a semantic template two parser extensions are needed:


 * ParserCoordinates.php
 * InsertMap.php

The first converts coordinates to latitude or longitude values. The second takes these values and inserts a map in a page.

If a normal page holds:

Template:Location holds:

6 is the zoomlevel. Variables the insert_map function takes and their default values are:

$lat = '1', $lon = '1', $zoom = '2', $type = 'G_HYBRID_MAP', $controls = 'GSmallMapControl', $class = 'pmap', $width = , $height = , $style = ''

Insert Coordinates Form Map
In the semantic form a little map is inserted that displays a map.

This requires a hack of the Semantic Forms extension.


 * SF_FormPrinter.inc

Use this code to call the map in the form:

Coordinates: