Extension:Tetherless Map

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Tetherless Map

Release status: beta

SemanticMaps.png
Implementation Parser functions
Description Allows users to generate maps based on query results from Semantic Mediawiki.
Author(s) Jin Guang Zheng and Rui Huang and Jie Bao and Li Ding
Last version 0.1.1 (2008-11-19)
MediaWiki 1.9.* or greater
License GPL
Download See here
Example RPI (Campus) Map

Check usage (experimental)

RPI Map 1
RPI Map 2

Contents

[edit] What does this extension do?

In this extension, we provide a parser function, #map_objects, that can generate a map based on results from a semantic query. This extension requires the Semantic Mediawiki extension and uses Google Map API.

The extension will accomplish the following tasks:

  • Data presentation:
    • Displays coordinate and information related to the corresponding coordinate.
    • Displays information provided in a KML file.
    • Provides a Semantic Group Control, a group of checkboxes represent properties of coordinates for users to filter query result, and display the result on the map.
    • Shows the number of objects displayed on the map after filtering (All information provided by KML file will be consider as One object).
  • Navigation:
    • Provides a list of coordinates' name(page name); users can click on coordinate's name to adjust the center of the map at that coordinate.
    • A search bar to filter the names of coordinates on the list.

In this extens ion we also provide another parser function, #insert_map, that will display limited information of a coordinate:

  • Only the coordinate of location and an info-window contain the information user provided.

Note: A map will always be centered at the last point passed to the parser function.

[edit] Download and installation

You can download the code at:

In order to use this extension, you must obtain a Google Maps API Key for your wiki. You may get your key here. Please read Google Map terms and service.

After you get your Google Maps API Key and downloaded code, place the 'TetherlessMap' directory within your MediaWiki 'extensions' directory. Then, add the following code to your LocalSetting.php after the line that installs Semantic MediaWiki (and after the line that installs Semantic Forms, if you use it)

$wgGoogleMapsKey = "...enter your Google Maps API key here...";
$wgLocalPath= "...enter your host server address...";

require_once ("$IP/extensions/TetherlessMap/Individual_Location.php");
require_once ("$IP/extensions/TetherlessMap/GoogleMapClick.php");
require_once ("$IP/extensions/TetherlessMap/GoogleMapMultiObjects.php");

[edit] Dependencies

This extension requires Semantic MediaWiki.

The extension can also be optionally used with Semantic Forms for a user-friendly interface of map editing.

[edit] Usage

[edit] Usage of #map_objects

[edit] Passing map information via a table

This parser function is able to display a set of coordinates on the map, and present information about those coordinates (e.g., picture, properties, etc.) in corresponding coordinate's info-window.

User can pass information by inputting a HTML table. This type of usage does not require the installation of the Semantic Mediawiki. Sample syntax:

{{#map_objects:
<table id="querytable1">
    <tr>
        <td>133 Sunset Terrace</td>
        <td>42.72897,-73.66867</td>
        <td>http://map.rpi.edu/index.php/133_Sunset_Terrace</td>
        <td>133-S</td>
        <td>Service</td>
        <td>images/7/72/Eaton2.JPG</td>
    </tr>
    <tr>
        <td>15th Street Parking</td>
        <td>42.72856,-73.6779</td>
        <td><a href="http://map.rpi.edu/index.php/15th_Street_Parking" class="external free" title="http://map.rpi.edu/index.php/15th_Street_Parking" rel="nofollow">http://map.rpi.edu/index.php/15th_Street_Parking</a></td>
        <td>15th.St[P]</td>
        <td>Parking</td>
        <td></td>
    </tr>
</table>
}}

Note: This parser function is order sensitive, and the first 3 parameters are required. User can skip the remaining parameters, e.g.,

{{#map_objects:
<table class="smwtable" id="querytable1">
    <tr>
        <td>15th Street Parking</td>
        <td>42.72856,-73.6779</td>
        <td>http://map.rpi.edu/index.php/15th_Street_Parking</td>
        <td></td>
        <td>Parking</td>
        <td></td>
    </tr>
</table>
}}

The order of parameters in each row of the table is:

  • 1st: Name of coordinate
  • 2nd: Latitude , Longitude
  • 3rd: Link to the coordinate's page
  • 4th (optional): Coordinate's name on the map
  • 5th (optional): any information for semantic group e.g., coordinate's property/service.
  • 6th (optional): relative link to image

[edit] Passing the map information via a semantic query

Another way which is more commonly used, is that user can pass map information to the parser function is using a semantic query.

A sample syntax:

{{#map_objects:
{{#ask: [[Category:Location]] | ?Has LatLong | ?Has URL | ?Has short name
| ?Has service |?FOAF:page |limit=200|link=none}}
}}

Important: First three parameters (page name, Latitue Longitude, and URL to the page)are required in order to display coordinates properly on map, where LatLong is latitude and longitude of a coordinate in this format: lat,long. The order of parameters is the same as in the table way.

If a user would like to provide a shorter name or any string to label the marker on the map, user can pass this information in the 4th parameter. User can skip this parameter by leave it empty, e.g.:

{{#map_objects:
{{#ask: [[Category:Location]] | ?Has LatLong | ?Has URL | | ?Has type |?FOAF:page |limit=200|link=none}}
}}

The 5th parameter (?Has type in this case) is where the user can pass information about coordinate for generating Semantic Group. To show a group, the group should have a least one location.

The 6th parameter (?FOAF:page in this case) is where a user can provide a picture of the location, which will be displayed on a pop-up window. The picture must be a hyperlink to the picture file.

[edit] Display information using KML files

User can also pass links of KML files to display KML files' information on the map. Please see more information on KML Documentation Introduction.

Sample syntax for passing one KML file:

{{#map_objects:
{{#ask: [[Category:Location]] | ?Has LatLong | ?Has URL | | ?Has service |?FOAF:page |limit=200|link=none}}
|Route;http://shuttles.rpi.edu/data/route.kml
}}

In this example, "Route;http://shuttles.rpi.edu/data/route.kml" is where user can pass the KML file. Where "Route" is a semantic group controller name of the information provided in this KML file. "http://shuttles.rpi.edu/data/route.kml" is the link to the KML file. Important Note: notice that "Route" and "http://shuttles.rpi.edu/data/route.kml" is separated by ";"

Sample syntax for passing more than one KML file:

{{#map_objects:
{{#ask: [[Category:Location]] | ?Has LatLong | ?Has URL | | ?Has service |?FOAF:page |limit=200|link=none}}
|Route;http://shuttles.rpi.edu/data/route.kml Stop;http://shuttles.rpi.edu/data/stops.kml Building;http://shuttles.rpi.edu/data/building.kml
 }}

The syntax for passing multiple KML file is almost the same as passing only one KML file, but space is used to separate multiple KML files.

Note: to present KML information on this map, we need at least one coordinate on the map provided by first semantic query or a table. (TO DO: this restriction will be removed)

[edit] Change Dimensions and Controls of Map

The default parameters of the map is set as the following:

width= 800
height= 600
zoom= 16
map type= G_HYBRID_MAP
map control= GSmallMapControl

You can change any of above parameter. The order of these parameters are:

  1. (Map data: a table or a semantic query)
  2. (KML files)
  3. zoom level
  4. map type
  5. map control
  6. css class attribute
  7. width
  8. height

More details about map control and map type can be found at http://code.google.com/apis/maps/documentation/controls.html

Sample syntax:

{{#map_objects:
{{#ask: [[Category:Location]] | ?Has LatLong | ?Has URL | | ?Has service |?FOAF:page |limit=200|link=none}}
|Route;http://shuttles.rpi.edu/data/route.kml
|17
|G_HYBRID_MAP
|GSmallMapControl
|pmap
|800
|600
}}

Note: dimension and control of map start at the third parameter.

[edit] Usage of #insert_map

This parser function will provide limited information of a single coordinate on map.

A sample syntax:

{{#insert_map: 17.3,17.8
|2
|G_HYBRID_MAP
|GLargeMapControl
|class1
|800
|600
|border: thin dotted #00FF00
|<b>This is an example</b>
|Empire Building
}}

The order of these parameters are:

  1. coordinate
  2. zoom level
  3. map type
  4. map control
  5. css class attribute
  6. width
  7. height
  8. css style attribute
  9. a html formated string to be displayed on info-window
  10. marker's label name

Note: The coordinate can be a value returned by a semantic query.

Note: this function was modified from a similar function provided in Extension:Semantic Google Maps

[edit] Bugs, new feature request and contact information

Please reports bug, feature requests, or any feedback to zhengj3-at-rpi.edu

[edit] Sites that use this extension

[edit] Other Resources

[edit] Release Log

  • Date: 2008-11-19, version number:0.1.1, Version Description: initial version, download link:TetherlessMap

a

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox