Extension:UserLocalization

Introduction
The UserLocalization MediaWiki Extension (ULE) provides tags to integrate [OpenLayers] maps with information about the spatial location of the contributing users of a MediaWiki installation.

The UsereLocalization Extension provides four differnt maps:
 * The UserHomeMap: A map for each User for showing his home location on his 'User:Username' page.
 * The Usermap: A map of all wiki user home locations.
 * The UserEditLocationMap: A map of the Locations from where a User edited a wiki article.
 * The ArticleEditLocationMap: A map of the locations from whre an wiki article was edited.

System Overview
The users of the Wiki providing their home location (Coordinates and if they want also the adress) with the 'ulMap' tag syntax as described below. This information for each user get stored in a PostGIS enabled PostgresSQL data table. The Extension also implemnts a wiki save hook. This can be seen as an event, which is triggered each time an article of the wiki gets saved. From this hook the IP adress from the editing user is looked up for its geo coordinates with the service of [hostip.info], this geo information connected to the articlename and the editing user is stored in a second PostGIS enabled Postgres database table.

The application uses the following third party software e.g. services:
 * Openlayers - for building the maps.
 * PostgreSQL + PostGIS - for storing the data.
 * hostip.info - as the service for GeoCoding the users IP Adress.

Download and unpack the Extension

 * Download the extension code from [here].
 * Unpack the compressed Folder to your MediaWiki Extension folder (i.e. /extensions).

Setting up the Database
To run the UserLocalization Extension you need to have access to a PostgreSQL Database with PostGIS extension installed. $server = " "; $db = " "; $user = " "; $pass = " ";
 * In the 'ulDB.php' file in the UserLocalization Folder edit the Database access information.
 * 1) Database connection information

-- Table: editlocation
 * create a new database or add the following two tables to an exsisting database in your PostGIS enabled PostgreSQL server.

-- DROP TABLE editlocation;

CREATE TABLE editlocation ( uname character varying(25),  article character varying(50),  "timestamp" character varying(11),  ip character varying(16),  city character varying(25),  country character varying(25),  "location" geometry ) WITH (OIDS=FALSE); -- Table: users

-- DROP TABLE users;

CREATE TABLE users ( uname character varying(15),  rname character varying(30),  locationname character varying(50),  "location" geometry ) WITH (OIDS=FALSE); The easiest way to do this, is to copy/paste these two SQL's into the SQL-Query Tool from pgAdmin or phppgAdmin. If you don't have access to either of this two tools, you can copy the SQL's to an textfile each and named it for instance 'users.sql'. and 'editlocation.sql' and run the following command from your servers command line. psql -f users.sql

psql -f editlocation.sql

Edit LocalSettings.php
include_once('extensions/UserLocalization/userLocalization.php');
 * 1) Include the following line into the LocalSettings.php of your MediaWiki installation:

Showing a Map
A Map is shown by including a pre defined (parser) tag into a wiki page. These tags have a given syntax for the parametes which are given to the map render functions described below. The parameters for width, height and zoom are optional, if not given, a standart value is set.

UserHomeMap: Map of a users home location
This map can only be included on the Users User:Username page in the MediaWiki. Because from this tag the UserLocalization system gets the home location (Lat/Lon) of the user. Because of that this map should only included once per User in a MediaWiki Installation. Additionaly the system gets the Usernam string from the Title of the Wiki page in particular the string after the 'User:' namespace.

To include the map use the following syntax:

Example:

UserMap: Map of the home locations of the Wiki users
This map shows the home locations of all users, which includet the 'ulMap' tag on their user page.

Example:

UserEditLocationMap: Map of the users edit locations
This map shows the locations from where a user has edited wiki artikles. For each location the number of edits and the edited articles are shown in the marker popup.

Example:

ArticleEditLocationMap: Map of the edit locations of an article
This map shows the locations from where users have edited the given wiki article.

Example: