Tiger 2017 data no longer contains -divroad- field

This commit is contained in:
marc tobias
2017-10-20 15:17:51 +02:00
parent fcf7fcee03
commit 8eed1a8bec

View File

@@ -3469,6 +3469,12 @@ def parse_shp_for_osm( filename ):
poLayer = poDS.GetLayer( 0 ) 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() poLayer.ResetReading()
ret = [] ret = []
@@ -3561,11 +3567,13 @@ def parse_shp_for_osm( filename ):
if tags["highway"] != "primary": if tags["highway"] != "primary":
tags["highway"] = "secondary" tags["highway"] = "secondary"
divroad = poFeature.GetField("DIVROAD") # TIGER 2017 no longer contains this field
if divroad != None: if 'DIVROAD' in fieldNameList:
if divroad == "Y" and "highway" in tags and tags["highway"] == "residential": divroad = poFeature.GetField("DIVROAD")
tags["highway"] = "tertiary" if divroad != None:
tags["tiger:separated"] = divroad if divroad == "Y" and "highway" in tags and tags["highway"] == "residential":
tags["highway"] = "tertiary"
tags["tiger:separated"] = divroad
statefp = poFeature.GetField("STATEFP") statefp = poFeature.GetField("STATEFP")
countyfp = poFeature.GetField("COUNTYFP") countyfp = poFeature.GetField("COUNTYFP")