Wikitravel:How to create a map
From Wikitravel
Contents
This page gives detailed instructions for creating Wikitravel maps using OpenStreetMap data.
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.
This process may seem a little unwieldy or intimidating the first time around, but almost all the work is really done for you, and it's infinitely faster than trying to draw your own map. So give it a shot!
[edit] Download and configure
- Install xmlstarlet [1] as per the instruction on their website (sudo apt-get install xmlstarlet will install it on Ubuntu)
- Download a copy of the wtp-maps tool. (You will need darcs for this; sudo apt-get install darcs will install it for you on Ubuntu machines.)
darcs get http://wikevent.org/repository/wtp-maps
- This creates a directory called "wtp-maps". Rename the directory after your destination, which in this tutorial we'll just call Destination.
- Open Config.mk in your favorite editor and edit the following line to contain the name of your destination on Wikitravel:
################### SETTINGS ###################### # The name of the article in Wikitravel ARTICLE = Destination
[edit] Draw and export 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 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.
- Once you are satisfied that everything is in place, click the [Export] tab and move the view so you can see the desired map area. Note that you will not see the changes you just made, but don't worry: they have been saved, it just takes a view (up to a day) until the OSM website gets around to rendering them.
- Select "Format to export" as "OpenStreetMap XML Data" and download the resulting file. Name it data.osm and move it to your working directory.
- The exporting can take several minutes if you're downloading a large chunk of a big city, so be patient. If your browser times out, try downloading the URL (http://api.openstreetmap.org/api/0.5/map?bbox=...) with the command line tool wget.
[edit] Generate map
- Run the command make. This will automatically do the following:
- Download the Wikitravel article
- Extract all its listing names into listings.txt
- Match them against the information in data.osm
- 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 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] 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.
|
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.
[edit] Check readability
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.
[edit] Finalize and export map
- Open a new Inkscape document and from File > Document Properties set it to be exactly 6.875in wide and 3.95in high.
- Use File > Import... to import "Destination-raw.png"
- Object > Align and Distribute it to align to the top edge and right edge of the page, then resize it (while pressing CTRL) until it precisely covers the page.
- Use File > Import... to import listings.svg. Resize it, clean it up and place it on the map.
- Do any last-minute tweaks.
- Choose File > Export Bitmap... from the menu and export to 3008x1730px as "Destination.png".
- Load the exported bitmap in GIMP (or another bitmap editor) and select Image→Mode→Indexed Color dialog. Select indexed mode, 64 colors, dithering off, and run the conversion -- this cuts down file size nicely.
Congratulations -- your map is done!
[edit] Help?
Need help? Something not working the way you think it should? Ask on the Talk page, or drop the maintainers of wtp-maps, User:Mark and User:Jpatokal, a line. Jpatokal 11:01, 9 June 2008 (EDT)

