OSM-Atlas

OSM-Atlas is a script to create a PDF atlas from OpenStreetMap data. It creates a PDF file, with front & back covers, overview map, detailed map pages, and index.

It can be used to create both street atlases of a local area, and road atlases of larger areas.

Initial Setup

You will need the following installed and working:

Also, xsltproc and sed, which are normally included in a Linux install by default.

Configuration

When OSM-Atlas is run, a configuration file is specified. This means that you can have several configuration files set up, for different areas. There are two sample configuration files included - inc_roadatlas.php (with sensible defaults for a road atlas of a large area) and inc_streetatlas.php (with sensible defaults for a street atlas of a smaller area, eg a city).

Copy one of the sample configuration files, and rename the file to something sensible. Then, edit the file in a text editor. The configuration items are detailed below:

$LEFT = 0, $RIGHT = 0, $TOP = 0, $BOTTOM = 0: These four settings define the bounding box of the area that the atlas will cover.

$HORIZ_TILES, $VERT_TILES: The number of horizontal and vertical tiles (images) that the atlas will split the map into. Each tile is on a single page.

$OV_FONT, $OV_FONT_SIZE: The file name and size of a TTF font that can be used to add numbers to the overview map.

$OSMARENDER_DIR, $OSMOSIS_DIR: The directories containing osmarender and osmosis.

$OUTPUT_DIR: The directory where files should be placed. Temporary working files and the created PDF will be put in this directory.

$DATA_FILE: The location of the .osm data file. Must be a local file. The OSM Wiki Planet page has links to suitable files (note that they are compressed using bzip2, and will need to be uncompressed).

The configuration settings shown above are the only settings that have to be configured. Those detailed below can be safely left at their defaults.


$TITLE: The title used on the title page.

$INDEX_STREET_NAMES, $INDEX_PLACE_NAMES: Set to True to include an index of street/place names, False to not include the index. In the sample files, the street atlas includes street names but not place names, while the road atlas includes place names but not street names.

$INKSCAPE_DPI: Each image in the atlas is a .png file, exported from Inkscape. This sets the DPI (dots per inch) setting that Inkscape uses when exporting.

$STYLESHEET: The osmarender stylesheet to use. osm_atlas-z16.xml, included with OSM-Atlas, is a customised version of the standard z16 stylesheet, for use when making a street atlas.
$STYLESHEET_THUMBS: The osmarender stylesheet to use for the thumbnail images in the overview map. osm_atlas-z12.xml, included with OSM-Atlas, is a customised version of the standard z12 stylesheet, for use when making a street atlas.

$DELETE_WORKING_FILES: OSM-Atlas creates many temporary files. If this is true, these files are deleted when OSM-Atlas has finished. Setting this to false will mean that these temporary files are not deleted, which may be useful for debugging, or if you wish to manually edit the LaTeX file.

$PDFTITLE, $PDFAUTHOR, $PDFSUBJECT, $PDFKEYWORDS: PDF file metadata.

$LOG_FILE: Full path to a log file. This will not be deleted when OSM-Atlas has finished. Set it to /dev/null if you don't need a log.

$DEBUG: If set to True, OSM-Atlas will output extra debugging information to the log file.

Running

Once the configuration file is set up, open a terminal and cd to the directory, then run:

./osm-atlas.php config.php
where config.php is the name of the configuration file to use. Note: OSM-Atlas cannot cope with paths or files that include spaces.

OSM-Atlas will display progress as it works. When it has finished, it will have created a PDF file, with front & back covers, overview map, detailed map pages, and index (if either $INDEX_STREET_NAMES or $INDEX_PLACE_NAMES was set to True).

Licence Information

Copyright © 2009 Russell Phillips

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Map data © OpenStreetMap (and) contributors, CC-BY-SA. (Donate to OpenStreetMap)