Readme added.

This commit is contained in:
Sergey Vartanov 2015-08-04 01:55:43 +03:00
parent 128ad8f8e8
commit e408d537ee
4 changed files with 40 additions and 3 deletions

21
README.md Normal file
View file

@ -0,0 +1,21 @@
Map generation
--------------
**Requirements**: Python 2.7.
python mapper.py -i <input OSM XML file name> -o <output SVG file name>
### Options ###
<table><tr><td><tt>-bbox</tt>, <tt>--boundary-box</tt>
</td><td>Boundary box to draw
</td></tr><tr><td><tt>--show-missed-tags</tt>
</td><td>Show not drawed tags as text
</td></tr></table>

14
doc/readme.moi Normal file
View file

@ -0,0 +1,14 @@
\2 {Map generation} {map_generation}
\b {Requirements}: Python 2.7.
\code
{python mapper.py -i \formal {input OSM XML file name} -o \formal {output SVG file name} }
\3 {Options}
\table
{
{{\tt {-bbox}, \tt {--boundary-box}} {Boundary box to draw}}
{{\tt {--show-missed-tags}} {Show not drawed tags as text}}
}

View file

@ -253,7 +253,7 @@ def line_center(node_ids):
return Vector((ma.x + mi.x) / 2.0, (ma.y + mi.y) / 2.0) return Vector((ma.x + mi.x) / 2.0, (ma.y + mi.y) / 2.0)
def draw_ways(): def draw_ways(show_missed_tags=False):
for level in sorted(layers.keys()): for level in sorted(layers.keys()):
layer = layers[level] layer = layers[level]
#for entity in ['b', 'h1', 'h2', 'r', 'n', 'l', 'a', 'le', 'ba']: #for entity in ['b', 'h1', 'h2', 'r', 'n', 'l', 'a', 'le', 'ba']:
@ -387,7 +387,7 @@ def draw_ways():
draw_path(way['nodes'], 'fill:#D0D0C0;stroke:#AAAAAA;opacity:1.0;') draw_path(way['nodes'], 'fill:#D0D0C0;stroke:#AAAAAA;opacity:1.0;')
c = line_center(way['nodes']) c = line_center(way['nodes'])
shapes, fill, processed = get_icon(way['tags'], scheme, '444444') shapes, fill, processed = get_icon(way['tags'], scheme, '444444')
draw_shapes(shapes, True, points, c.x, c.y, fill, True, way['tags'], processed) draw_shapes(shapes, True, points, c.x, c.y, fill, show_missed_tags, way['tags'], processed)
for tag in way['tags']: for tag in way['tags']:
v = way['tags'][tag] v = way['tags'][tag]
if tag == 'building': if tag == 'building':
@ -689,7 +689,7 @@ if options['draw_ways']:
icons = extract_icon.IconExtractor('icons.svg') icons = extract_icon.IconExtractor('icons.svg')
if options['draw_ways']: if options['draw_ways']:
draw_ways() draw_ways(show_missed_tags=options['show_missed_tags'])
draw_nodes(show_missed_tags=options['show_missed_tags'], draw_nodes(show_missed_tags=options['show_missed_tags'],
overlap=options['overlap'], draw=options['draw_nodes']) overlap=options['overlap'], draw=options['draw_nodes'])

2
ui.py
View file

@ -29,6 +29,8 @@ def parse_options(args):
options['draw_ways'] = False options['draw_ways'] = False
elif arg in ['--show-missed-tags']: elif arg in ['--show-missed-tags']:
options['show_missed_tags'] = True options['show_missed_tags'] = True
elif arg in ['--no-show-missed-tags']:
options['show_missed_tags'] = False
elif arg in ['--overlap']: elif arg in ['--overlap']:
options['overlap'] = int(next(args)) options['overlap'] = int(next(args))
else: else: