Last active
July 19, 2018 14:56
-
-
Save maxerickson/d6d1da30fc94581b343a090c2ffa3419 to your computer and use it in GitHub Desktop.
ogr2osm.py translation file for MA state addresses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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