Skip to content

Commit

Permalink
#1 Refactor parse_tags function
Browse files Browse the repository at this point in the history
  • Loading branch information
mattesCZ committed Aug 13, 2016
1 parent 83f7e94 commit 814a1a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions osm_data_processing/relations2lines/relation.py
Expand Up @@ -54,17 +54,17 @@ def __init__(self, row):
self.parse_tags()

def parse_tags(self):
tags = [tag for i, tag in enumerate(self.rawTags) if not i % 2]
values = [tag for i, tag in enumerate(self.rawTags) if i % 2]
tags = dict(zip(self.rawTags[::2], self.rawTags[1::2]))
cleanse_func = lambda x: tags[x].replace('\\', 'backslash')
if 'network' in tags:
self.network = values[tags.index('network')]
self.network = tags['network']
self.network = self.network[:3]
if 'mtb:scale' in tags:
self.mtbScale = values[tags.index('mtb:scale')].replace('\\', 'backslash')
self.mtbScale = cleanse_func('mtb:scale')
if 'mtb:scale:uphill' in tags:
self.mtbUphill = values[tags.index('mtb:scale:uphill')].replace('\\', 'backslash')
self.mtbUphill = cleanse_func('mtb:scale:uphill')
if 'osmc:symbol' in tags:
osmc_string = values[tags.index('osmc:symbol')].replace('\\', 'backslash')
osmc_string = cleanse_func('osmc:symbol')
symbol = OsmcSymbol(osmc_string)
if symbol.is_accepted():
self.osmcSymbol = symbol.get_string_value(3)
Expand Down

0 comments on commit 814a1a1

Please sign in to comment.