From: marc tobias Date: Fri, 20 Oct 2017 13:17:51 +0000 (+0200) Subject: Tiger 2017 data no longer contains -divroad- field X-Git-Tag: v3.1.0~40^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/8eed1a8bec5e1e3273e399dd0aba42a781cc38a7?hp=fcf7fcee03c8d9a67e1ecace61df81aa81201936 Tiger 2017 data no longer contains -divroad- field --- diff --git a/utils/tigerAddressImport.py b/utils/tigerAddressImport.py index 5499f50e..bdbf3b25 100755 --- a/utils/tigerAddressImport.py +++ b/utils/tigerAddressImport.py @@ -3469,6 +3469,12 @@ def parse_shp_for_osm( filename ): poLayer = poDS.GetLayer( 0 ) + fieldNameList = [] + layerDefinition = poLayer.GetLayerDefn() + for i in range(layerDefinition.GetFieldCount()): + fieldNameList.append(layerDefinition.GetFieldDefn(i).GetName()) + # sys.stderr.write(",".join(fieldNameList)) + poLayer.ResetReading() ret = [] @@ -3561,11 +3567,13 @@ def parse_shp_for_osm( filename ): if tags["highway"] != "primary": tags["highway"] = "secondary" - divroad = poFeature.GetField("DIVROAD") - if divroad != None: - if divroad == "Y" and "highway" in tags and tags["highway"] == "residential": - tags["highway"] = "tertiary" - tags["tiger:separated"] = divroad + # TIGER 2017 no longer contains this field + if 'DIVROAD' in fieldNameList: + divroad = poFeature.GetField("DIVROAD") + if divroad != None: + if divroad == "Y" and "highway" in tags and tags["highway"] == "residential": + tags["highway"] = "tertiary" + tags["tiger:separated"] = divroad statefp = poFeature.GetField("STATEFP") countyfp = poFeature.GetField("COUNTYFP")