biketrip.org:Mapserver
From biketrip.org
biketrip.org uses MapServer 5.4.2 as a cartographic and topological engine. Through a homemade small extension for MediaWiki, we're able to send requests and get results for MapServer or its Php port, Php/MapScript. It works really really well, the results are splendid, the only problem is that sometimes it freezes but a refresh clears it just fine.
The MapServer extension for MediaWiki has not been released, it's really just parsing some instructions to php/Mapscript and displaying the results, really it's super basic. If you want any information, please contact User:Alex and he'll be happy to give you hints.
Contents |
[edit] What it can do
[edit] Display maps
All the maps on biketrip.org are based on a map of the World using a Robinson projection, but any map will work. The extension creates a <mapserver> tag that is used to send the request and a few parameters. The legend created for each map is included in the MapServer Mapfile definition but the next version of the extension will send the legend request via the tag. For example, to create the map showing the nb of links the tag looks like this:
{{#tag:mapserver|links+big+France:15;Brazil:5;Australia:50}}
It returns the following map:
I use the {{#tag:mapserver writing instead of <mapserver> just because it handles the templates and queries before handling the mapserver query. As you can see, the first parameter is 'link' which calls the links mapfile definition, the second 'big' is used for the size of the map and then the list of objects with the value to be mapped.
{{#tag:mapserver|helmet+small+Spain:No;United States of America:No;China:Yes}}
The helmet map uses simple Yes or No values, the legend doesn't appear on small maps.
[edit] Clickable maps
All 'big' maps are clickable. The coordinates are processed by a SpecialPage on Mediawiki which returns the name of the page. In our case, the name of the geo objects in the map, the countries, are the same as the name of the page for these countries. The Php/Mapscript doesn't have yet an instruction to convert screen coordinates to map coordinates so the calculation is done 'by hand'. That outputs sometimes weird results, especially with projection having a big deformation at the poles like the Robinson's in our case.
[edit] Topology
The extension can return topological results based on geometrical queries. The one we use here is to determine the surrounding countries of a given country. Let's see an example with France:
{{#tag:mapserver|surrounding++France}}
will output the following result :
[edit] Countries surrounding France
It looks very good but due to the method used by MapServer to calculate the surrounding geometry, the bounding box, some false results appear, like The Netherlands showing up in our example (France doesn't touch The Netherlands). Mapserver simply 'draws' an imaginary box around France and selects everything that's inside that box without doing a second more precise request. Well, that's ok in our case, nobody will actually mind seeing the false result but it could be a problem for further applications. I'm sure the results can be checked by a secondary request based on the first results, I'll look it up in a later version if there's a need for it.
[edit] Integration with Semantic Wiki
All the information about countries is tagged with properties on biketrip.org. These properties come from another extension called Semantic Wiki which, basically, allows displaying some results based on simple queries. Like 'send me the names of the countries where the 'Helmet' property is set to yes'. Parsing the result of these queries instead of typing the name of the countries and the value to be mapped allows on-the-fly dynamic mapping. If someone adds the information saying that Helmets in Brazil are not compulsory, the map will be updated automatically thanks to the result from Semantic Wiki. It's way more powerful than it sounds if it's used right. Templates are used to format the results to something that's usable by the MapServer extension.
[edit] Testing and Comments
Please use the discussion page of this article to test and comment it.
Well, that's it for now. It's only the very first version of the MapServer Extension, if there's a need for it, either on biketrip.org or for other people I'll add more features and parameters.

