Skip to content

Instantly share code, notes, and snippets.

@lxbarth
Last active December 17, 2015 02:39
Show Gist options
  • Save lxbarth/5537879 to your computer and use it in GitHub Desktop.
Save lxbarth/5537879 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# Translate DC building shapefiles with ogr2osm https://github.com/pnorman/ogr2osm
#
# Run:
# python ogr2osm/ogr2osm.py buildings.shp -t ogr2osm/translations/dcbuildings.py
#
# This will create a buildings.osm file ready to be opened, *reviewed* and uploaded with JOSM.
#
# This is preliminary code, not ready to be used for an import yet.
#
from pprint import pprint
def filterTags(attrs):
if not attrs:
return
tags = {}
tags['building'] = 'yes'
if 'ADDRNUM' in attrs:
tags['addr:housenumber'] = attrs['ADDRNUM']
if 'STNAME' in attrs and 'STREET_TYP' in attrs and 'QUADRANT' in attrs:
tags['addr:street'] = '%s %s %s' % (attrs['STNAME'].lower(), attrs['STREET_TYP'].lower(), attrs['QUADRANT'])
if 'GIS_ID' in attrs:
tags['mappingdc:gid'] = attrs['GIS_ID']
return tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment