Mapgen.pl

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages
English русский
Mapgen.pl
Screenshot of Mapgen.pl
Author: user:Garry68
Version: 1.12 (2010-11-17)
Platform: linux

easy to use cause limited concept

mapgen is a Perl based rendering engine that takes a .osm file and a style file. It then generates an SVG (and using inkscape also PDF and PNG) output. Current Version does not run under Windows.

Also visit Hikingbook.pl to see how complex hiking maps for routes or an street atlas can be automatically generated.

I am thinking about a Successor for mapgen... And here it is: Mapweaver

Maps and sample files

Samples

Old

Goals

  • Fast and easy map generation, different output formats
  • Fast extraction of needed data out of *.osm files (place=*)
  • Easy style file handling
  • Street and place directories
  • Keep it simple (easy invocation with only 2 mandatory parameters)
  • Keep it powerful (by using more parameters)

Features

  • Mercator projection
  • one step creation of SVG, PDF and PNG files
  • automatic map generation for a given place name (v0.05)
  • style file can easily be maintained in OO or MS Excel (just export to csv; field delimiter SPACE, text delimiter ")
  • multipolygon support (v0.06)
  • labels ways and nodes (even with multiple values)
  • intelligent way and poi label placement (collision detection, way bend information)
  • Additional conversion to PNG and PDF is possible if inkscape is installed.
  • Legend drawing is automatic according to style file. (can be switched off, different positions)
  • As an option a grid or coordinates can be overlayed
  • Another option is to automatically create a street and/or POI directory (with grid reference); also formatted in PDF (via latex, dvips and ps2pdf - automatically. Mapgen102dir.pdf)
  • Data can be clipped at the edge to allow for missing/incomplete data in osm file
  • Some scale functions
  • Multi-label support
  • Tag statistics for rule optimization
  • Route support with stops and dedicated symbols/icons per route
  • icon patterns for areas
  • support different definition and output resolutions
  • shields as way labels

Algorithms and Details

Documentation


Hints

  • if there are letters missing in labels, please increase ppc value of 6. specify -ppc=6.5 i.e. (ppc = points per character (at 10pt)
  • my 10" netbook with 1024x600 resolution has 117 dpi (you can use that with [-scaledpi])
  • my 18" monitor with 1280x1024 resolution has 90 dpi (you can use that with [-scaledpi])
  • Acrobat Standard (9) can print large PDFs over several pages! Even overlaps can be set.
  • My evince document viewer has problems rendering areas with tile patterns! Use another viewer if problems become visible.
  • Interesting article about labeling
  • Performance: Hamburg (157MB OSM file) in 1:50.000 uses 370MB of RAM and takes about 22 min. (incl. PDF conversion) on my little netbook

Wishes / Open Topics / Ideas

  • specify label tag for way shields
  • shields for nodes
  • ini file for some internally set values
  • scale bridge/tunnel thickness upon way thickness?
  • optional title in map
  • Open Sea Map support (lighthouses, buoys, more?)
  • [-forceicons] (and labels; would draw icons and labels without bothering about declutter)
  • blank background for ruler and scale
  • Using another projection library which is compatible to Windows
  • it seems the legend can only be placed in the top left or lower right corners. It would be great if it could be placed in the other corners too.
  • Version for Windows? - as far as I know it runs with active perl and some other installations? Otherwis install Virtualbox. Gary68.
No, Geo::Proj4 fails under ActivePerl for Windows --ajoessen

Versions

v1.19 (April 2nd, 2011)

  • circles also for ways/areas; circle thickness error corrected

v1.18 (April 1st, 2011)

  • shields as way labels

v1.17 (March 29th, 2011)

ATTENTION! For this version the rule files have to be adapted. See last chapter in manual.

  • new dash definitions, more flexible
  • position of ruler, grid labels and scale value changed
  • legend labels can now be defined




Older Versions

Installation and Sources

Since there is so much information now collected this topic will be presented on a new sub-page: Mapgen.pl/Installation

Usage

  • download an area with josm or via the "export" tab from the main site as XML data. Store it in the same folder as your mapgen.pl file and as a .osm file.
  • go to the directory where mapgen.pl and the other files are placed with the cd command.
  • say your map is named "map.osm", execute the following command:
perl mapgen.pl -in=map.osm -style=mapgenRules.csv
  • this will create a mapgen.svg file with your map.

notes

if you process your osm file with josm before you make your map, be sure not to use the delete (DEL) but the purge (CTRL+SHIFT+P) command. Nodes you deleted with the delete command will still be rendered.

to see what options you can use (e.g. to disable the legend or to adjust the size of the image) run

perl mapgen.pl -help