diff --git a/icons.svg b/icons.svg index f0d61ff..b540196 100644 --- a/icons.svg +++ b/icons.svg @@ -13,7 +13,7 @@ height="600px" id="svg2987" version="1.1" - inkscape:version="0.48.5 r10040" + inkscape:version="0.48.3.1 r9886" sodipodi:docname="icons.svg"> @@ -24,9 +24,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="22.627417" - inkscape:cx="18.27553" - inkscape:cy="283.63521" + inkscape:zoom="11.313708" + inkscape:cx="39.978746" + inkscape:cy="363.12941" inkscape:current-layer="layer1" inkscape:document-units="px" showgrid="true" @@ -34,10 +34,10 @@ inkscape:guide-bbox="true" inkscape:object-paths="true" inkscape:snap-bbox="true" - inkscape:window-width="1515" - inkscape:window-height="990" - inkscape:window-x="33" - inkscape:window-y="24" + inkscape:window-width="913" + inkscape:window-height="768" + inkscape:window-x="181" + inkscape:window-y="204" inkscape:window-maximized="0"> - - + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccc" /> - + id="clockwise_2" + inkscape:label="#clockwise" /> + id="contrclockwise_2" + inkscape:label="#contrclockwise" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mapper.py b/mapper.py index 88dbf29..1307094 100644 --- a/mapper.py +++ b/mapper.py @@ -27,17 +27,23 @@ import svg from vector import Vector background_color = 'EEEEEE' +building_color = 'D4D4D4' # 'D0D0C0' +building_border_color = 'C4C4C4' # 'AAAAAA' +construction_color = 'CCCCCC' grass_color = 'C8DC94' sand_color = 'F0E0D0' beach_color = 'F0E0C0' desert_color = 'F0E0D0' -playground_color = '884400' parking_color = 'DDCC99' +playground_color = '884400' +primary_border_color = '888888' # 'AA8800' +primary_color = 'FFFFFF' # 'FFDD66' water_color = 'AACCFF' water_border_color = '6688BB' wood_color = 'B8CC84' -tags_to_write = set(['operator', 'opening_hours', 'cuisine', 'network', 'website', +tags_to_write = set(['operator', 'opening_hours', 'cuisine', 'network', + 'website', 'website_2', 'STIF:zone', 'phone', 'branch', 'route_ref', 'brand', 'ref', 'wikipedia', 'description', 'level', 'wikidata', 'name', 'alt_name', 'image', 'fax', 'old_name', 'artist_name', 'int_name', @@ -54,7 +60,7 @@ tags_to_write = set(['operator', 'opening_hours', 'cuisine', 'network', 'websit 'ref_no', 'uri', 'fhrs:inspectiondate', 'telephone', 'naptan:AltCommonName', 'end_date', 'facebook', 'naptan:Notes', 'voltage', 'last_collection', 'twitter', 'ele', 'information', - 'phone_1', 'cyclestreets_id', + 'phone_1', 'cyclestreets_id', 'cladr:code', # To draw 'naptan:Bearing', 'species', 'taxon', 'seats', 'capacity', 'fhrs:rating', 'fhrs:confidence_management', 'fhrs:hygiene', @@ -288,6 +294,9 @@ def draw_ways(show_missed_tags=False): style = 'fill:#' + parking_color + ';stroke:none;' draw_path(way['nodes'], style) draw_point_shape('parking', c.x, c.y, '444444') + elif way['tags']['landuse'] == 'construction': + style = 'fill:#' + construction_color + ';stroke:none;' + draw_path(way['nodes'], style) elif way['tags']['landuse'] in ['residential', 'commercial']: continue else: @@ -350,7 +359,7 @@ def draw_ways(show_missed_tags=False): style = 'fill:none;stroke:#AAAAAA;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:round;stroke-width:' if v == 'motorway': style += '30' elif v == 'trunk': style += '25' - elif v == 'primary': style += '20;stroke:#AA8800' + elif v == 'primary': style += '20;stroke:#' + primary_border_color elif v == 'secondary': style += '13' elif v == 'tertiary': style += '11' elif v == 'unclassified': style += '9' @@ -369,7 +378,7 @@ def draw_ways(show_missed_tags=False): style = 'fill:none;stroke:#FFFFFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:' if v == 'motorway': style += '28' elif v == 'trunk': style += '23' - elif v == 'primary': style += '19;stroke:#FFDD66' + elif v == 'primary': style += '19;stroke:#' + primary_color elif v == 'secondary': style += '11' elif v == 'tertiary': style += '9' elif v == 'unclassified': style += '7' @@ -384,58 +393,11 @@ def draw_ways(show_missed_tags=False): text_y = 0 #if 'building:levels' in way['tags']: #floors = float(way['tags']['building:levels']) - draw_path(way['nodes'], 'fill:#D0D0C0;stroke:#AAAAAA;opacity:1.0;') + draw_path(way['nodes'], 'fill:#' + building_color + ';stroke:#' + building_border_color + ';opacity:1.0;') c = line_center(way['nodes']) shapes, fill, processed = get_icon(way['tags'], scheme, '444444') draw_shapes(shapes, True, points, c.x, c.y, fill, show_missed_tags, way['tags'], processed) - for tag in way['tags']: - v = way['tags'][tag] - if tag == 'building': - if v == 'yes': - pass - elif v == 'apartments': - draw_point_shape('apartments', c.x, c.y, '444444') - elif v == 'kindergarten': - draw_point_shape('playground', c.x, c.y, '444444') - elif tag == 'amenity': - if v == 'cafe': - draw_point_shape('cafe', c.x, c.y, '444444') - elif v == 'theatre': - draw_point_shape('theatre', c.x, c.y, '444444') - elif v == 'fast_food': - draw_point_shape('fast_food', c.x, c.y, '444444') - elif v == 'snack_cart': - draw_point_shape('cafe', c.x, c.y, '444444') - elif tag == 'shop': - if v == 'clothes': - draw_point_shape('shop_clothes', c.x, c.y, '444444') - elif v == 'gift': - draw_point_shape('shop_gift', c.x, c.y, '444444') - elif tag == 'power': - draw_point_shape('electricity', c.x, c.y, '444444') - #elif tag in ['name', 'addr:housenumber', 'cladr:code', - # 'addr:city', 'addr:street', 'website', - # 'wikidata'] or \ - # 'name' in tag or 'wikipedia' in tag: - # draw_text(v, str(c.x), str(c.y + 18 + text_y), '444444') - # text_y += 10 - #elif tag == 'addr:country': - # if v == 'RU': - # draw_text('Россия', str(c.x), str(c.y + 18 + text_y), '444444') - # else: - # draw_text(v, str(c.x), str(c.y + 18 + text_y), '444444') - # text_y += 10 - elif tag in ['layer', 'height']: - pass - elif tag in ['building:levels']: - pass - else: - kk = tag - vv = v - if ('way ' + kk + ': ' + vv) in missed_tags: - missed_tags['way ' + kk + ': ' + vv] += 1 - else: - missed_tags['way ' + kk + ': ' + vv] = 1 + icons_to_draw.append({'shapes': shapes, 'x': c.x, 'y': c.y, 'fill': fill, 'priority': 1}) for way in layer['le']: c = line_center(way['nodes']) if way['tags']['leisure'] == 'playground': @@ -654,6 +616,10 @@ output_file = svg.SVG(open(options['output_file_name'], 'w+')) w, h = 2650, 2650 +if 'size' in options: + w = options['size'][0] + h = options['size'][1] + output_file.begin(w, h) output_file.rect(0, 0, w, h, color=background_color) @@ -668,6 +634,7 @@ if 'boundary_box' in options: authors = {} missed_tags = {} points = [] +icons_to_draw = [] # {shape, x, y, priority} scheme = yaml.load(open('tags.yml')) scheme['cache'] = {} diff --git a/tags.yml b/tags.yml index 150c532..d1ca9f4 100644 --- a/tags.yml +++ b/tags.yml @@ -32,6 +32,7 @@ colors: 'beach': 'F0E0C0' 'deciduous': 'FCAF3E' 'desert': 'F0E0D0' + 'evergreen': 'B8CC84' 'playground': '884400' 'parking': 'DDCC99' 'water': 'AACCFF' @@ -43,7 +44,7 @@ tags: - tags: {place: quarter} draw: false - tags: {building: 'yes'} - icon: [building] + draw: false - tags: {amenity: bench} icon: [bench] - tags: {amenity: bench, backrest: 'yes'} @@ -96,6 +97,8 @@ tags: icon: [shop_convenience] - tags: {building: store} icon: [shop_convenience] +- tags: {building: apartments} + icon: [apartments] - tags: {amenity: shop, shop: kiosk} icon: [kiosk] - tags: {shop: gift} @@ -132,6 +135,8 @@ tags: color: wood - tags: {natural: tree, leaf_cycle: deciduous} color: deciduous +- tags: {natural: tree, leaf_cycle: evergreen} + color: evergreen - tags: {natural: tree, denotation: urban} over_icon: [urban_tree_pot] under_icon: [tree, broadleaved, needleleaved] diff --git a/ui.py b/ui.py index 6fe3ebd..7d91f7d 100644 --- a/ui.py +++ b/ui.py @@ -33,6 +33,8 @@ def parse_options(args): options['show_missed_tags'] = False elif arg in ['--overlap']: options['overlap'] = int(next(args)) + elif arg in ['-s', '--size']: + options['size'] = map(lambda x: float(x), next(args).split(',')) else: print 'Unknown option: ' + arg return None