Skip to content

Instantly share code, notes, and snippets.

@oeon
Forked from frewsxcv/gist:1262862
Created October 4, 2011 22:52
Show Gist options
  • Save oeon/1263089 to your computer and use it in GitHub Desktop.
Save oeon/1263089 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'] == 'ROAD':
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'})
elif attrs['CATEGORY'] == 'CEMETERY':
tags.update({'highway':'service'})
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