YOU CAN EDIT THIS PAGE! Just click any blue "Edit" link and start writing!

Wikitravel:How to create a map/Expert maps

From Wikitravel
Jump to: navigation, search

This is an archive.

Expert maps[edit]

The process described below requires a fair amount of technical skill and is slightly outdated. There is an updated fork though, with a slightly different process: [email protected]. Other options may be Wikitravel:How to draw a map or Wikitravel:How_to_draw_a_map#SVG imports from OSM instead.

This process can be used to create full-fledged Wikitravel maps with automatically placed and indexed icons for sights, restaurants, hotels, etc.

Prerequisites: Access to a machine running modern flavors of Unix, preferably Linux and most preferably Ubuntu. Also, the Wikitravel destination that you want to map must already be using the new listings tag format.

Process Overview[edit]

The map creation process now follows these steps:

  1. Download and install the Osmatravel scripts (formerly known as wtp-maps)
  2. Find your destination in Open Street Map
  3. Choose to either collect the map coordinates or create a boundary relation to define the region to be mapped
  4. Add an appropriate image tag to your article to configure the map create
  5. Run the scripts to generate an SVG image
  6. "Edit OSM" as necessary to improve your map
  7. Regenerate the SVG Image
  8. Examine and adjust the SVG as necessary
  9. Upload the SVG to Wikitravel shared
  10. Run the scripts to generate a PNG image
  11. Upload the PNG to Wikitravel shared

Download and install the scripts[edit]

  • Install xmlstarlet [1] as per the instruction on their website (sudo apt-get install xmlstarlet will install it on Ubuntu)
  • Download the current Gitorious tarball of the Osmatravel (formerly wtp-maps) scripts.
  • Unpack the tarball somewhere convenient, in your home directory for instance, or perhaps in $HOME/src.
 tar -xvzf osmatravel-osmatravel-master.tar.gz
  • This will create a new directory "osmatravel-osmatravel/" containing the scripts. Enter the directory.
 cd osmatravel-osmatravel
  • The first time you run the scripts you'll have to specify an article. If it's the first time you've generated a map for a given article it's best to do it in steps. For instance if you simply want to generate a config file for a particular article you can do this:
 make ARTICLE=Paris/1st_arrondissement

Please note that spaces in the article name should be replaced by underscores (_), and parentheses should be replaced with %28 for left parenthesis and %29 for right parenthesis.

  • You can reconfigure the scripts to use a different destination any time you like by doing something like this:
 make clean; make ARTICLE=Paris/2nd_arrondissement

Find the destination in OSM[edit]

Choose a method for defining the bounding box[edit]

When you are configuring an article for map generation for the first time you have a choice to make about how you configure the map's bounding box.

  • You can draw a relation boundary around the are which you mean to map. The Osmatravel scripts will calculate a rectangular bounding box which contains this relation, regardless of its shape, plus some padding.
  • You can copy the lat-long coordinates of the corners of a rectangular area as viewed in OSM.

Each method has advantages: if you draw a relation it will be rendered in the map as a slightly lighter grey, giving the destination part of your map a little more visual relief. If you configure exact lat-long coordinates the scripts will run a bit faster. If you want both advantages you can use both methods.

Configure an Image tag for the map in Wikitravel[edit]

The Osmarender scripts now take their configuration information for a given destination from the Wikitravel article itself. This means that all configuration data for any particular map project is publicly available under a version of the CC by-sa license.

Configuration is done by adding some extra attributes to a MediaWiki Image tag for an appropriately named image. A couple of these are required by the scripts in order to render a map, but some of them are optional:

Required Attributes[edit]

  • relid


  • border
  • Is_in

Optional Attributes[edit]

  • expand_for_listings
  • listings_placement
  • box_width
  • box1_x
  • box1_y
  • box2_x
  • box2_y
  • box3_x
  • box3_y
  • box4_x
  • box4_y


map of the 8th Arrondissement

Generate map[edit]

  • Run the command make. This will automatically do the following:
  1. Download the OSM data within the border defined earlier into data.osm
  2. Download the Wikitravel article
  3. Extract all its listing names into listings.txt
  4. Match the listings against the OSM data
  5. Create a vector map called map.svg, including icons for all listings it could match
  6. Create a vector listings box called listings.svg
  • Check the file unmatched.txt, which contains all Wikitravel listings not found in the OSM data. If something did not match properly...
    • If you fixed the mistake in Wikitravel and saved your change, then run make wt-clean and run make again.
    • If you fixed the mistake in OSM, then re-export the data and run make again.

Edit in OSM[edit]

OSM Potlatch editor (satellite layer off)
  • Browse to the OpenStreetMap site and browse to your destination.
  • Click the [Edit] tab, which loads the Potlatch flash editor in your browser. [Play] around, read the docs and watch the video at the Potlatch page until you feel comfortable; then [Start] mapping.
  • Odds are other kind OSMers have already added the streets and basic city features, so your job now is to add and check the Wikitravel listings.
  • To add a new listing, double-click on a point on the map to create a new node. Choose the appropriate type (below), then click the [+] icon (lower left corner) and add new tags to it. The important tag is name, which must match the Wikitravel listing's name exactly. However, if Wikitravel is using the English name but OSM is not, you can add a name:en tag to the OSM node.

The following is a quick reference for mapping Wikitravel listings to OSM map features. The complete list is available here.

Wikitravel listing Type OSM tag OSM tag value
See Museum tourism museum
See Church, mosque, etc amenity place_of_worship
Eat Restaurant amenity restaurant
Drink Bar, pub amenity pub
Drink Nightclub amenity nightclub
Sleep Hotel tourism hotel
Sleep Hostel tourism hostel
Sleep Campground tourism camp_site
Bus station amenity bus_station
Train station railway station

Note that these tags are used by OSM only and are, at the moment and in general, not needed for Wikitravel map generation.

Defining the map's edges as a relation in Potlatch
  • To define the edges of your map, draw a way around the edges of the area, connecting back to the starting point.
    • Depending on your requirements, this can be a simple square box or a complicated district polygon.
    • Do not define it as a road or anything, just leave it as an unnamed way.
  • Click on the Relation Editor button (the "chain link" icon on the left side) in Potlatch.
    • Select "Create new relation".
    • Enter "type": "border". Click [+] to add a new tag, enter "name" and the Destination you entered earlier in Click [+] once more, enter "Is_In" and the Region from (See screenshot for an example.)

Clean up map[edit]

A "raw" OSM export
  • Load up map.svg in your favorite SVG editor, eg. Inkscape.
  • Find your city center. (OSM exports often contain lengthy roads and rivers sticking way out of the selected region, so you may need to zoom around.)
  • Draw a horizontal rectangle with Fill: None.
  • Select the rectangle with the pointer tool and set W(width) to 300.8 and H (height) to 173.0.
    • If you want a vertical rectangle, swap around the height and width.
    • If you have a large area, you can use multiple rectangles to cover it.
  • Resize the rectangle to your liking while pressing down CTRL; this keeps the proportions constant.
  • OSM exports may have overlapping city names, icons under streets and other slight messiness. Clean up the area within the rectangle to your liking.

Current versions of Inkscape allow you to edit OSM-generated maps, but hopelessly corrupt the output if you try to save them. The workaround below thus exports the SVG into a PNG bitmap and then continues work on that.

  • When finished, select the rectangle and choose File > Export Bitmap... from the menu. Choose "Selection" and enter 3008x1730 px as the size. Save it as "Destination-raw.png".
  • Close map.svg.

Check readability[edit]

If this is the first time you're exporting this city, this is a good moment to verify that the map is readable when printed. Load the map in GIMP (or another bitmap editor) and set Image > Print size... to be 6.875in wide and 3.95in high, then print it out on your printer (in grayscale mode). If you can read the street names without squinting, it's fine.

Finalize and export map[edit]

The finished map

Type the following command:

 make png

If Inkscape is properly installed the scripts will run it in the background. Next they will run the Gimp to reduce the colorspace of the image for the web. You should now find a PNG image in the directory named for your article, and ready for upload to Wikitravel shared. You should examine it just in case.

Congratulations -- your map is done!