Wikivoyage:How to create a map/Expert maps
||This page is currently inactive and is retained for historical reference. Either the page is no longer relevant or consensus on its purpose has become unclear. Do not assume content on this page is still correct or up-to-date.|
- 1 Expert maps
- 1.1 Process Overview
- 1.2 Download and install the scripts
- 1.3 Find the destination in OSM
- 1.4 Choose a method for defining the bounding box
- 1.5 Configure an Image tag for the map in Wikivoyage
- 1.6 Generate map
- 1.7 Edit in OSM
- 1.8 Clean up map
- 1.9 Check readability
- 1.10 Finalize and export map
This process can be used to create full-fledged Wikivoyage 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 Wikivoyage destination that you want to map must already be using the new listings tag format.
The map creation process now follows these steps:
- Download and install the Osmatravel scripts (formerly known as wtp-maps)
- Find your destination in Open Street Map
- Choose to either collect the map coordinates or create a boundary relation to define the region to be mapped
- Add an appropriate image tag to your article to configure the map create
- Run the scripts to generate an SVG image
- "Edit OSM" as necessary to improve your map
- Regenerate the SVG Image
- Examine and adjust the SVG as necessary
- Upload the SVG to Wikivoyage shared
- Run the scripts to generate a PNG image
- Upload the PNG to Wikivoyage shared
Download and install the scripts
- Install xmlstarlet  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.
- 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 Config.mk 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 Config.mk ARTICLE=Paris/2nd_arrondissement
Find the destination in OSM
Choose a method for defining the bounding box
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 Wikivoyage
The Osmarender scripts now take their configuration information for a given destination from the Wikivoyage 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:
- Run the command make. This will automatically do the following:
- Download the OSM data within the border defined earlier into data.osm
- Download the Wikivoyage article
- Extract all its listing names into listings.txt
- Match the listings against the OSM data
- Create a vector map called map.svg, including icons for all listings it could match
- Create a vector listings box called listings.svg
- Check the file unmatched.txt, which contains all Wikivoyage listings not found in the OSM data. If something did not match properly...
- If you fixed the mistake in Wikivoyage 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
- 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 Wikivoyage 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 Wikivoyage listing's name exactly. However, if Wikivoyage 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 Wikivoyage listings to OSM map features. The complete list is available here.
|Wikivoyage listing||Type||OSM tag||OSM tag value|
|See||Church, mosque, etc||amenity||place_of_worship|
Note that these tags are used by OSM only and are, at the moment and in general, not needed for Wikivoyage map generation.
- 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 Config.mk. Click [+] once more, enter "Is_In" and the Region from Config.mk. (See screenshot for an example.)
Clean up map
- 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.
- 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.
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
Type the following command:
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 Wikivoyage shared. You should examine it just in case.
Congratulations -- your map is done!