Skip to content

Instantly share code, notes, and snippets.

@frewsxcv
Created October 4, 2011 21:26
Show Gist options
  • Save frewsxcv/1262862 to your computer and use it in GitHub Desktop.
Save frewsxcv/1262862 to your computer and use it in GitHub Desktop.
San Luis Obispo translation file (ogr2osm)
def translateAttributes(attrs):
if not attrs:
return
tags = {}
if int(attrs['SPD_PST']) > 0:
tags.update({'maxspeed':attrs['SPD_PST'] + ' mph'})
if attrs['FULLNAME']:
tags.update({'name:fullname':attrs['FULLNAME'],'source:maxspeed':'sign' })
if attrs['ONE_WAY'] in ('FT', 'TF'):
tags.update({'oneway':'yes'})
else:
tags.update({'oneway':'no'})
if attrs['CATEGORY'] in ('ROAD', 'CEMETARY'):
tags.update({'highway':'residential'})
elif attrs['CATEGORY'] in ('ALLEY', 'CAMPGROUND', 'MOBILE HOME PARK', 'PARK ROAD', 'PIER'):
tags.update({'highway':'service'})
elif attrs['CATEGORY'] == 'DRIVEWAY':
tags.update({'highway':'service','service':'driveway'})
elif attrs['CATEGORY'] == 'FREEWAY':
tags.update({'highway':'motorway'})
elif attrs['CATEGORY'] == 'HIGHWAY':
tags.update({'highway':'primary'})
elif attrs['CATEGORY'] == 'RAMP':
tags.update({'highway':'motorway_link'})
elif attrs['CATEGORY'] == 'TRAIL':
tags.update({'highway':'path'})
if attrs['PAVED'] == 'YES':
tags.update({'surface':'paved'})
elif attrs['PAVED'] == 'NO':
tags.update({'surface':'unpaved'})
return tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment