OSM on Paper/Printing via Maperitive, Inkscape, and Osmosis
Overall steps for creating wall maps from OSM data:
This tutorial is based on experience in generating 1.5 meter by 1.5 meter wall maps of Ashgabat city and similar wall atlases of the highway network of Turkmenistan. Hence, the tutorial refers to Turkmenistan, but the basic principles apply to any point on Earth.
Software needed:
Maperitive version 2.4.1
a commercial paint program, such as Adobe Photoshop or Corel Photo Paint is desirable for adding final touches
Hint: Create a separate file space on your computer to store all the files you will be using and creating. A suitable file structure might look something like this:
\Maps
\\OSM
\\PNG
\\SVG
Detailed steps:
Download data from a mirror site.
1. Surf to www.openstreetmap.org.
2. Zoom to the approximate area you want to download.
3. Click on the “Export” button.
4. Click on “Manually select a different area”.
5. Either move the borders of the selected area with the mouse (click and drag) or type in latitudes and longitudes of desired boundaries in the white boxes.
6. Click on “Overpass API”.
7. When the file has been downloaded, change its name from “map” to something like yyyymmdd_city.osm, e.g., 20190716_Ashgabat.osm, and move it to the OSM folder.
This file contains the raw XML data used to build the map.
If this file is too large for Maperitive to open directly, use Osmosis to extract only the data you want from the downloaded file.
1. Install Osmosis if it is not already installed. It requires Java, so if Java is not installed, you will need to install it first.
2. Run a series of Osmosis scripts to extract subsets of the downloaded .osm file, selecting only those variables you really need to generate a map.
3. Store those extracts in the OSM folder.
The road atlas of all of Turkmenistan requires this step. The datasets for individual Turkmen cities are small enough for Maperitive to handle in one attempt, but the entire country includes too much data. Hence Osmosis is needed to extract only those data desired on the road atlas.
Format data using Maperitive and an appropriate style sheet (“rendering rules”).
1. Open Maperitive. Be sure to use version 2.4.1, as subsequent versions do not support a critical rendering rule that allows vertical repositioning of labels.
2. Click on the yellow star next to the line “Web map (OSM Mapnik)”. This turns off data extraction directly from OSM.
3. Open the folder containing the Turkmenistan-specific rendering rules you want to use (*.mrules). Drag and drop that file onto Maperitive. (Hint: There is a more elegant way of doing this; read the online instructions to learn how to add custom rendering rules to the dropdown menu).
4. Click on File / Open Map Sources and select the .osm files that Osmosis created. Do NOT open the original .osm file downloaded from the web.
Maperitive will render the map based on the data you have extracted and the rendering rules you have applied.
Use Maperitive to generate an SVG file containing the raw map.
1. Click on Map / Set Printing Bounds and move the boundaries to the area you want included in the printed map.
2. Use Maperitive commands to zoom to the desired level (7,000 is good for Ashgabat; 50,000 is good for a wall atlas of Turkmenistan).
3. Click “Tools / Export to SVG (For Inkscape)”. Save the output file in the SVG folder with an appropriate name (yyyymmdd_city.svg). You may also use the command line for more control of this.
The SVG file generated will be large, between 3 and 5 megabytes. It will also, due to crowding of points of interest, tend to have lost some information. The beauty of editing SVG files using Inkscape lies in the ability to grab entire objects (e.g., symbols, names of buildings, names of streets) and move them manually to “better” positions that do not block other information. The downside is that Inkscape features dodgy memory management and files this large cause the computer to slow down tremendously, making editing of such a large file very time-consuming. You will likely find it necessary periodically to save your work, reboot the computer, and continue after clearing all memory. You will also find it useful to close many programs running in the background to free up as much memory as possible.
Hand edit the SVG file in Inkscape as needed for accuracy.
Use Inkscape to delete duplicates of street names, add desired symbols, and to add back labels of items skipped by Maperitive due to crowding (this requires substantive knowledge of the geography of the area in the map). In the road atlas of Turkmenistan, depending on the zoom level, cities may be left out; in the city maps, major points of interest (hospitals, embassies, etc.) may be crowded out by close neighbors. In Ashgabat, names of neighborhoods can either be squeezed out or they may squeeze other points of interest out. The manual editing can be tedious but it is crucial to the quality of the final product.
Hint: Name labels are in two parts, the white “halo” behind the letters, and the letters in whatever color the rendering rules have specified in front. Creating a label that looks original takes a little work. You have to create first the halo letters and instruct Inkscape to make those letters thicker than usual, then create the regular letters with normal thickness, superimpose the latter over the former, and as a final touch, hold down the shift key while clicking on each text in turn, and group them so you can treat them as a single object. Creating new labels will require familiarization with Inkscape’s text tools. The font in the Turkmenistan maps is Calibri in bold. The fill and stroke of the halo text should be set at 1.132. Play with it and you’ll figure it out.
Hint: Save your work often.
Use Inkscape to generate a PNG file from the SVG.
Click File / Export PNG Image. Save the output file in the PNG folder with an appropriate file name, e.g., yyyymmdd_city.png.
The PNG output file will be massive, on the order of ~100Mb for the city map of Ashgabat.
Add final touches using a paint program (Adobe Photoshop or Corel Photo Paint).
Anything you could not fix with Inkscape can be fixed now. In addition, be sure to add any legends (much easier with a bitmap editor like Photoshop or Photo Paint) plus the OpenStreetMap copyright notice. Save the final file with a name like yyyymmdd_city_Final.png
Send to printer.
Professional print shops can generally handle PNG files with no problem. Be sure to inform the printer what the desired dimensions of the map should be.
Additional Information
- the Maperitive style file (rendering rules file) used for producing a 1.5 meter by 1.5 meter wall map of Ashgabat city is here.
- Sample Osmosis scripts for extracting data are here.