AutoMap Extension

From Wikivoyage Tech

Jump to: navigation, search

An extension that provides automatically generated maps using data from OpenStreetMap, SRTM and our Location Database.

Contents

[edit] License

GPL.

[edit] How it works

See Clickable Maps from LocDB and free data sources for the goals and the basic algorithm.

This extension works on the LocDB maintenance side as well as on the application side (our regular wikis).

[edit] On the LocDB

The extension is activated by a line

require_once( 'extensions/LocDB/AutoMap/input/AutoMapTrigger.php');

in the LocDB's LocalSettings.php.

Class LdbAutoMapTrigger does the main work by hooking into several hooks provided by the LocDB. Its task is to surveil the modifications made in the LocDB and mark existing maps as outdated whenever appropriate. It also tells the map generating class LdbAutoMap what part of the map data is outdated.

[edit] On regular wikis

The extension is activated by a line

require_once( 'extensions/LocDB/AutoMap/input/AutoMap.php');

in the wiki's LocalSettings.php.

On the application side, this extension provides the parser tag <automap> and the special page AutoMaps. Both are driven by the central class LdbAutoMap which calculates and maintains the projection parameters and polygons for click sensitive areas.

The actual map generation is done by Mapnik which is invoked as an external process. Since mapnik might need up to some minutes for maps with large areas, the map generation process is split into two steps. The first step is a draft generated during the web request. The second step is done by a background daemon job which runs as a maintenance script on shared:.

All map images are in PNG format and stored as SysImages in the special repository.

[edit] Parser tag automap

The parser tag takes one optional attribute, called type. It lets the author choose from predefined map typs, but so far, there is only one defined: click. The tag produces a clickable map fit into a 350x350 pixel box or an error message if no map is possible.

[edit] Special page AutoMaps

This special page can display three kinds of maps: clickable, clickable overview and OSM. OSM is just an inline display of original OSM maps. Clickable maps are maps fit into a 800x800 pixel box with click sensitive areas. The difference between clickable and clickable overview is that clickable overview zooms out by factor 4.

[edit] Generated Maps

The maps are calculated from the OSM database. Also, a hill shade relief calculated from the SRTM elevation model is added. The borders of the location in question as well as its sublocations are shown as white lines.

The hill shade is calculated by GDAL tools and the map rendering is done by Mapnik.

There are tons of parameters for tuning Mapnik and the exact outcome of the maps. Any improvements and comments on the optical map design are welcome.

Personal tools
Participation