Skip to content

Instantly share code, notes, and snippets.

@maxerickson
Last active July 19, 2018 14:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save maxerickson/d6d1da30fc94581b343a090c2ffa3419 to your computer and use it in GitHub Desktop.
ogr2osm.py translation file for MA state addresses.
def filterTags(tags):
if tags is None:
return
newtags = {}
if tags["STREETNAME"]!="":
newtags["addr:street"]=tags["STREETNAME"].title()
if tags["STATE"]!="":
newtags["addr:state"]=tags["STATE"]
if tags["ZIPCODE"]!="":
newtags["addr:postcode"]=tags["ZIPCODE"]
if tags["ADDR_NUM"]!="":
newtags["addr:housenumber"]=tags["ADDR_NUM"]
if tags["TOWN"]!="":
newtags["addr:city"]=tags["TOWN"].title()
if tags["UNIT"]!="":
newtags["addr:unit"]=tags["UNIT"].title()
if tags["FLOOR"]!="":
newtags["level"]=tags["FLOOR"]
return newtags
# can fetch all data outside of boston with curl:
# curl http://download.massgis.digital.mass.gov/shapefiles/mad/town_exports/addr_pts/{AddressPts_M}[001-351]{.zip} -o '#1#2#3'
#
# then operate directly on zipfile:
# python ./ogr2osm/ogr2osm.py -t simpleMAtranslation.py AddressPts_M001.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment