Skip to content
automatically create maps for wikitravel articles using openstreetmap
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Table of Contents

Welcome to Osmatravel

This project is a fork of gitorious/osmatravel and intends to automate map-generation for Wikitravel articles.

It is an updated and slightly different process which tries to generate maps without much intervention. Thus it should allow the quick generation of maps even for smaller articles without much work effort.


The installation is straightforward, but requires a unix system, preferably Linux/Ubuntu:

Also make sure, you have xmlstarlet, inkscape and gimp installed.

Creating a new map

The key requirements are:

    echo ARTICLE=Town >; make

  • Upload the image (either by hand or use make upload-svg && make upload-png)

Some further notes

  • Most steps are still the same as in the original article
  • The old argument styles do not work anymore, see Variables.
  • The selected bbox area has a certain width and height, however this area is then adjust so that the map fill the actual specified width and height (size argument). This creates space either at the left or the bottom, where the listing boxes are then placed.
  • If further modifications / adjustments are needed it would be a good idea to adjust the code instead of individual maps / svg-files. Introduce another param, send a patch :)


The following variables can be usid in the image-Tag:

  • size: e.g. a4-landscape (default), a3-portrait... etc., 150x200 (width*height in mm)
  • zoom: the openstreetmap zoom-factor (1..17, default: 17)
  • is_in: used to create the Maps of Town category in the description
  • placement: the listing-box placement specification, e.g. bottom-left (default), top-right ...
    This also adjusts the map-extension creating free space to fit the size specification at the specified side.
  • osm_url: i.e.
  • border: the name of an relation (instead of relid/osm_url)
  • relid: the id of an relation (instead of border/osm_url)

Find the destination in OSM

See also: Wikitravel:How_to_create_a_map/Expert_maps#Find_the_destination_in_OSM

Fixing data

Add <listing name="..." /> for things that shall be on the map and make sure these nodes / ways are available in openstreetmap as well (also check to see that the other name="..." tags in the listings match the name or name:en tag in OSM. Only elements using the <listing> or <sleep> or <eat> etc. tags will be considered.

See also: Wikitravel:How_to_create_a_map/Expert_maps#Edit_in_OSM

Automated uploading to Wikitravel-Shared

1. Install pywikipedia (see Installation)

2. Configure pywikipedia. Create the file pywikipedia/

 # -*- coding: utf-8  -*-
 family = 'wikitravel_shared'
 mylang = ''
 usernames['wikitravel_shared']['wikitravel_shared'] = u'YOUR_USERNAME'
 password_file = 'wikitravel-password'

3. Store your wikitravel-shared password:

 echo "('YOUR_USERNAME', 'YOUR_PASSWORD')" > pywikipedia/wikitravel-password
 chmod 600 pywikipedia/wikitravel-password

4. Upload your generated maps:

 make upload-svg
 make upload-png

Multiple maps per article

You can use multiple maps per article. Each image must be name Town_$part_map_with_listings.png. You must then supply a MAP=$part argument whenever invoking a make command, e.g.:

 make MAP=center
 make MAP=center upload-png
 make MAP=overview
 make MAP=overview upload-png

An additional feature is, that you can limit listings to show up only in certain maps. This is controlled by the map attribute. Any listing without the attribute shows up in all maps (unless it's not in its bbox). Example:

 <listing name="Train station">shows up in all maps</listing>
 <sleep name="Hotel Central" map="center">shows only in center map</sleep>

You can specify multiple maps comma-separated.


Overlays are useful to indicate further information and especially required for overview maps. They are also very easy to produce:

 make listings.svg

Now edit using inkscape, select the Overlay layer and draw whatever needs to go on the map as well. When finished, delete all other layers, save the file as Town_overlay.svg (or Town_$part_overlay.svg if using multiple maps) and upload it to wikitravel:

 python pywikipedia/ -keep -noverify Town_overlay.svg
 rm overlay_page.html

Now recreate the map:


Further Ideas / TODO

  • Place listings that are not in OSM, but have lat and lon attributes on the map. If a listing is present in OSM but has lat/lon attributes, these should override the OSM location. This allows better placement for visual clearity.
  • create a webservice (similar to the Navit one) that allows bbox selection and automatically suggests paper-sizes for the selected zoom-level
  • create a webservice that generates the maps (svg-files)
You can’t perform that action at this time.