Tuesday, September 13, 2011

Spatial Wiki 13 - Testing and Template Modifications

This is lucky post number 13 in setting up a Spatial Wiki and we're pretty much done, just need to do some testing and tweaks to the Coord template.  See also the Extension:SpatialWiki Documentation for details on the options that the extension adds to MediaWiki.  For example, to begin with we'll display a map centered on the FOSS4G Conference in Denver, CO that's 400 pixels wide and 300 pixels tall by adding the following markup to a wiki page:
{{ #SpatialWikiMap: 39.741850 | -104.988790 | 15 | 400px | 300px | true }}

The map in the wiki page will look like this:
















The final "true" parameter in the SpatialWikiMap tag means include points for the spatially referenced articles.  We've not setup a proper spatially referenced article for the FOSS4G meeting, but the point is coming from the test data we loaded into our database.  It's clickable and a popup comes up with the name, but there is not a valid link to an article.

Displaying maps is only part of the problem, the first part was spatially locating an article, writing the coordinates to our spatial database, and displaying a map for that article.  We'll accomplish this by modifying the Template:Coord to look like this:
{{ #SpatialWikiMap:{{{1|12.0}}} | {{{2|20.0}}} | 10 | 507px | 350px | true | true }}

{| border="0" cellpadding="4" cellspacing="0" style="border:0px solid darkgray;"
! width="500px"|
|- 
| valign="top" style="background:#e4f7dd; border-style: solid; border-width: 1px 0 1px 0; border-color:darkgray"| {{PAGENAME}}: Latitude {{{1|0.0}}} Longitude {{{2|0.0}}}, Type {{{3|Undefined}}}
|}

This modified template will do two things, displaying a map for the location of the article with a nicely formatted box below it showing the location details. Let's try it by creating a new article for the Wyknkoop Brewery calling the template with:
{{Coord|39.7534|-104.9985|Test}}

The Wynkoop Brewery page will thus look like:


















Finally, go back to the main page and setup the map insert like this:

{{ #SpatialWikiMap: 12.0 | 20.0 | 2 | 100% | 400px | true }}

The final Spatial Wiki homepage has clickable locations of the spatially referenced articles as shown below. The spatial references as they are added or modified are written in real-time to the backend spatial database via the Extension:SpatialWiki for MediaWiki.

2 Comments:

At February 17, 2012 at 10:05 PM , Blogger Unknown said...

This comment has been removed by the author.

 
At February 17, 2012 at 10:06 PM , Blogger Unknown said...

Thanks for this writeup!! I have tried off and on for the last few months to get maps up and running using AWS/geoserver etc. and this is the first time i got it to work.

I could not get QGIS to run because "you have no DISPLAY environment variable set", but otherwise it's all good.

Again thanks... much appreciated!

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home