Difference between revisions of "Wikitravel:How to create a map"
Revision as of 12:24, 27 September 2009
This page gives detailed instructions for creating Wikitravel maps using OpenStreetMap data.
This easy three-step process can be used to create simple city street maps.
This process can be used to create full-fledged Wikitravel maps with automatically placed and indexed icons for sights, restaurants, hotels, etc. It 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!
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.
Note that in the fairly near future these scripts should be running as a Mapmaker bot which you will be able to interact with using a Wikitravel:Category.
The map creation process now follows these steps:
Download and install the scripts
tar -xvzf osmatravel-osmatravel-master.tar.gz
make Config.mk ARTICLE=Paris/1st_arrondissement
Please note that spaces in the article name should be replaced by underscores (_).
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.
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
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:
[[Image:Paris_8th_arrondissement_map_with_listings.png|thumb|350px|border=8ème arrondissement|is_in=Paris|relid=20872|expand_for_listings=no|listings_placement=manual|box1_x=10|box1_y=200|box1_h=90|box2_x=10|box2_y=10|box2_h=100|box3_x=164|box3_y=4|box3_h=0|box4_x=84|box4_y=249.2|box4_h=40|box_width=60|map of the 8th Arrondissement]]
Edit in OSM
The following is a quick reference for mapping Wikitravel listings to OSM map features. The complete list is available here.
Note that these tags are used by OSM only and are, at the moment and in general, not needed for Wikitravel map generation.
Clean up map
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
Congratulations -- your map is done!
SVG imports for users without Linux access
If you lack access to a computer with a Linux operating system, you will have to go through several more manual steps to generate a map from OSM data.
First, go to OpenStreetMap , zoom in on the area you wish to map, and then click the export tab. In this window, select "Mapnik Image" with an SVG format.
Choosing the appropriate scale depends to a degree on the size of the area being mapped, but in general you can get away with a low resolution export (which will decrease the file size of the exported SVG)—1:20,000 is not a bad resolution to start with. If the file size of the SVG export is too large, your computer may grind to a halt when modifying it in Inkscape .
The first and simplest thing you can do to reduce that filesize and make the SVG more manageable is to delete the light gray background object, which for some reason tends to include thousands of extraneous nodes. Be sure to vacuum definitions (File → Vacuum defs) after making such a significant deletion, in order to further reduce the file size.
Layers — separating content into layers will make your SVG more versatile and easier to manage (turning off complex layers will help speed up Inkscape). Create a layer for the OSM import, then add empty layers above it for streets, street names, etc.
First text. Unfortunately imported OSM SVGs do not contain text—all letters are in fact paths, which makes things more complicated. To begin, use the find operation (Ctrl+F) and enter "use" in the ID box; this should select all the black text in the SVG. Delete all selected "text." Then use the find operation again, and enter "stroke-miterlimit: 10" in the style box. Change the fill color of the selected objects to black, and remove the stroke color; all text will now appear in a more manageable form. Group the selected paths (text), move them to a text layer, then turn off that layer. (The text will likely need to be resized, and this can be done using the transform function → scale (Shift+Ctrl+M).)
This is where things get tricky. You must select all objects of one type (e.g., red-colored streets), combine them into one path (Ctrl+K), and then change the color to match the usual Wikitravel scheme. To select all paths/objects of one category, use the find operation. Red-colored streets are easy to select, for example, simply enter "stroke:#eb9799" to the style box in the find operation to select all red-colored streets. Combine the streets into one path, then move them to a dedicated streets layer, then turn that layer off. Repeat for all types of streets. To find unique attributes for the various street types, select one path, then open the XML editor (Shift+Ctrl+X), examine the style attribute, and find a unique value to enter into the find box. To match Wikitravel color standards, change the stroke colors to white (although freeways/highways can be colored red to distinguish them from city streets).
You will notice that most paths in the SVG have "shadow" paths behind them. Delete these paths. Also, selecting the street paths you have combined, then simplifying them (Ctrl-L) can reduce the file size and complexity of the SVG a good deal, usually without sacrificing much accuracy. At low resolutions, OSM SVGs display the street paths rather wide; select the combined street paths and change the stroke style width by an appropriate percent.
The colors of other objects, such as parks, buildings, and water areas, should also be changed to conform to Wikitravel standards. This can be done in the same manner, using the find function to select all objects of a specific type, and then using the fill function to change the color (or pattern). You can obtain standard colors and patterns here.
(Incidentally, if patterned objects display with the pattern appearing overly large, duplicate the patterned object(s), shrink the duplicated object(s) until the pattern displays at the desired size, then move the smaller object(s) to the bottom of the layer, combine it with the original object(s), then break them back apart, and delete the smaller duplicate object(s).)
The final tasks are much more simple, but are time intensive. What is left is to add travel icons, a key, title, compass, scale, etc. These tasks are described at Wikitravel:How to draw a map.