Wednesday, September 7, 2011

Spatial Wiki 12 - Install SpatialWiki Extension

The last part to complete our Spatial Wiki is to install the SpatialWiki Extension for MediaWiki.  This extension has been developed as part of this exercise, and allows you to store spatial references from a wiki page in the PostGIS database, and to display clickable maps of spatial locations in a wiki page.  Install the extension as follows:
cd /var/lib/mediawiki/extensions
sudo apt-get install subversion
sudo svn checkout svn://svn.code.sf.net/p/spatialwiki/code SpatialWiki

This installs the files in the folder /var/lib/mediawiki/extensions/SpatialWiki.  The next step is to add the extension and it's configuration parameters to LocalSettings.php.
sudo vi /etc/mediawiki/LocalSettings.php

Add the following lines at the end:
#
# ----- SpatialWiki Extension
#
require_once("$IP/extensions/SpatialWiki/SpatialWiki.php");
$wgSpatialWikiDebugMessages = false;
$wgSpatialWikiDatabase = "spatialwiki";
$wgSpatialWikiUsername = "postgres";
$wgSpatialWikiPassword = "[your password]";
$wgSpatialWikiPointsTable = "wikipts";
$wgSpatialWikiOpenLayersPath = "http://[your server]/OpenLayers-2.11-rc3";
$wgSpatialWikiWmsPointsUrl = "http://[your server]:80/geoserver/spatialwiki/wms";
$wgSpatialWikiGeoServerPointsLayer = "spatialwiki:view_wikipts";

Modify the parameters to match your installation, then open the wiki in a web browser and goto Special Pages and find the "Version" page to verify that the extension is installed properly. You should see something like this:








With the extension installed go back to the main page of the wiki and edit the page, removing all the custom HTML and JavaScript and replacing it with:
{{ #SpatialWikiMap: }}

This is a tag for the simplest map that can be added to a page, and will produce a page like:

















Goto the next article on Testing and Template Modifications.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home