'02013' : 'Aleutians East, AK' ,
'02016' : 'Aleutians West, AK' ,
'02020' : 'Anchorage, AK' ,
+'02230' : 'Skagway Municipality' ,
'02050' : 'Bethel, AK' ,
'02060' : 'Bristol Bay, AK' ,
'02068' : 'Denali, AK' ,
'02070' : 'Dillingham, AK' ,
'02090' : 'Fairbanks North Star, AK' ,
'02100' : 'Haines, AK' ,
+'02105' : 'Hoonah-Angoon Census Area' ,
'02110' : 'Juneau, AK' ,
'02122' : 'Kenai Peninsula, AK' ,
'02130' : 'Ketchikan Gateway, AK' ,
'02180' : 'Nome, AK' ,
'02185' : 'North Slope, AK' ,
'02188' : 'Northwest Arctic, AK' ,
+'02195' : 'Petersburg Census Area' ,
+'02198' : 'Prince of Wales-Hyder Census Area' ,
'02201' : 'Prince of Wales-Outer Ketchikan, AK' ,
'02220' : 'Sitka, AK' ,
'02232' : 'Skagway-Hoonah-Angoon, AK' ,
'02240' : 'Southeast Fairbanks, AK' ,
'02261' : 'Valdez-Cordova, AK' ,
'02270' : 'Wade Hampton, AK' ,
+'02275' : 'Wrangell City and Borough' ,
'02280' : 'Wrangell-Petersburg, AK' ,
'02282' : 'Yakutat, AK' ,
'02290' : 'Yukon-Koyukuk, AK' ,
'08011' : 'Bent, CO' ,
'08013' : 'Boulder, CO' ,
'08015' : 'Chaffee, CO' ,
+'08014' : 'Broomfield, CO',
'08017' : 'Cheyenne, CO' ,
'08019' : 'Clear Creek, CO' ,
'08021' : 'Conejos, CO' ,
'12081' : 'Manatee, FL' ,
'12083' : 'Marion, FL' ,
'12085' : 'Martin, FL' ,
+'12086' : 'Miami-Dade, FL' ,
'12087' : 'Monroe, FL' ,
'12089' : 'Nassau, FL' ,
'12091' : 'Okaloosa, FL' ,
'19135' : 'Monroe, IA' ,
'19137' : 'Montgomery, IA' ,
'19139' : 'Muscatine, IA' ,
-'19141' : 'O'Brien, IA' ,
+'19141' : 'O\'Brien, IA' ,
'19143' : 'Osceola, IA' ,
'19145' : 'Page, IA' ,
'19147' : 'Palo Alto, IA' ,
'24027' : 'Howard, MD' ,
'24029' : 'Kent, MD' ,
'24031' : 'Montgomery, MD' ,
-'24033' : 'Prince George's, MD' ,
-'24035' : 'Queen Anne's, MD' ,
-'24037' : 'St. Mary's, MD' ,
+'24033' : 'Prince George\'s, MD' ,
+'24035' : 'Queen Anne\'s, MD' ,
+'24037' : 'St. Mary\'s, MD' ,
'24039' : 'Somerset, MD' ,
'24041' : 'Talbot, MD' ,
'24043' : 'Washington, MD' ,
'56041' : 'Uinta, WY' ,
'56043' : 'Washakie, WY' ,
'56045' : 'Weston, WY' ,
+'60000' : 'AMERICAN SAMOA',
+'60010' : 'Eastern district, AS' ,
+'60020' : 'Manua district, AS' ,
+'60030' : 'Rose island, AS' ,
+'60040' : 'Swains island, AS' ,
+'60050' : 'Western district, AS' ,
+'66000' : 'GUAM' ,
+'66010' : 'Guam, GU' ,
+'69000' : 'COMMONWEALTH OF THE NORTHERN MARIANA ISLANDS' ,
+'69085' : 'Commonwealth of the Northern Mariana Islands, MP' ,
+'69100' : 'Commonwealth of the Northern Mariana Islands, MP' ,
+'69110' : 'Commonwealth of the Northern Mariana Islands, MP' ,
+'69120' : 'Commonwealth of the Northern Mariana Islands, MP' ,
+'72000' : 'PUERTO RICO',
+'72001' : 'Adjuntas, PR',
+'72003' : 'Aguada, PR',
+'72005' : 'Aguadilla, PR',
+'72007' : 'Aguas Buenas, PR',
+'72009' : 'Aibonito, PR',
+'72011' : 'Anasco, PR',
+'72013' : 'Arecibo, PR',
+'72015' : 'Arroyo, PR',
+'72017' : 'Barceloneta, PR',
+'72019' : 'Barranquitas, PR',
+'72021' : 'Bayamon, PR',
+'72023' : 'Cabo Rojo, PR',
+'72025' : 'Caguas, PR',
+'72027' : 'Camuy, PR',
+'72029' : 'Canovanas, PR',
+'72031' : 'Carolina, PR',
+'72033' : 'Catano, PR',
+'72035' : 'Cayey, PR',
+'72037' : 'Ceiba, PR',
+'72039' : 'Ciales, PR',
+'72041' : 'Cidra, PR',
+'72043' : 'Coamo, PR',
+'72045' : 'Comerio, PR',
+'72047' : 'Corozal, PR',
+'72049' : 'Culebra, PR',
+'72051' : 'Dorado, PR',
+'72053' : 'Fajardo, PR',
+'72054' : 'Florida, PR',
+'72055' : 'Guanica, PR',
+'72057' : 'Guayama, PR',
+'72059' : 'Guayanilla, PR',
+'72061' : 'Guaynabo, PR',
+'72063' : 'Gurabo, PR',
+'72065' : 'Hatillo, PR',
+'72067' : 'Hormigueros, PR',
+'72069' : 'Humacao, PR',
+'72071' : 'Isabela, PR',
+'72073' : 'Jayuya, PR',
+'72075' : 'Juana Diaz, PR',
+'72077' : 'Juncos, PR',
+'72079' : 'Lajas, PR',
+'72081' : 'Lares, PR',
+'72083' : 'Las Marias, PR',
+'72085' : 'Las Piedras, PR',
+'72087' : 'Loiza, PR',
+'72089' : 'Luquillo, PR',
+'72091' : 'Manati, PR',
+'72093' : 'Maricao, PR',
+'72095' : 'Maunabo, PR',
+'72097' : 'Mayaguez, PR',
+'72099' : 'Moca, PR',
+'72101' : 'Morovis, PR',
+'72103' : 'Naguabo, PR',
+'72105' : 'Naranjito, PR',
+'72107' : 'Orocovis, PR',
+'72109' : 'Patillas, PR',
+'72111' : 'Penuelas, PR',
+'72113' : 'Ponce, PR',
+'72115' : 'Quebradillas, PR',
+'72117' : 'Rincon, PR',
+'72119' : 'Rio Grande, PR',
+'72121' : 'Sabana Grande, PR',
+'72123' : 'Salinas, PR',
+'72125' : 'San German, PR',
+'72127' : 'San Juan, PR',
+'72129' : 'San Lorenzo, PR',
+'72131' : 'San Sebastian, PR',
+'72133' : 'Santa Isabel, PR',
+'72135' : 'Toa Alta, PR',
+'72137' : 'Toa Baja, PR',
+'72139' : 'Trujillo Alto, PR',
+'72141' : 'Utuado, PR',
+'72143' : 'Vega Alta, PR',
+'72145' : 'Vega Baja, PR',
+'72147' : 'Vieques, PR',
+'72149' : 'Villalba, PR',
+'72151' : 'Yabucoa, PR',
+'72153' : 'Yauco, PR',
+'78000' : 'VIRGIN ISLANDS' ,
+'78010' : 'St. Croix, VI' ,
+'78020' : 'St. John, VI' ,
+'78030' : 'St. Thomas, VI' ,
}
def fipsstate(fips,countyfp):
divroad = poFeature.GetField("DIVROAD")
if divroad != None:
- if divroad == "Y" and tags["highway"] == "residential":
+ if divroad == "Y" and "highway" in tags and tags["highway"] == "residential":
tags["highway"] = "tertiary"
tags["tiger:separated"] = divroad
rtags = []
ltags = []
tags = []
+ zipr = ''
+ zipl = ''
+ name = ''
+ county = ''
if "tiger:zip_right" in waykey:
zipr = waykey["tiger:zip_right"]
rtags.append( "<tag k=\"addr:postcode\" v=\"%s\" />" % zipr )
if right:
rlinestring = [];
for i, point in rsegment:
- rlinestring.append( "%f %f" % (point[0], point[1]) )
+ rlinestring.append( "%f %f" % (point[1], point[0]) )
if left:
llinestring = [];
for i, point in lsegment:
- llinestring.append( "%f %f" % (point[0], point[1]) )
+ llinestring.append( "%f %f" % (point[1], point[0]) )
if right:
rsegments.append( rsegment )
if left:
# ret.append( "</way>" )
ret.append( "select tigger_create_interpolation(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" %
- ( ",".join(rlinestring), rfromadd, rtoadd, interpolationtype, name, county, zipr ) )
+ ( ",".join(rlinestring), rfromadd.replace("'", "''"), rtoadd.replace("'", "''"), interpolationtype.replace("'", "''"), name.replace("'", "''"), county.replace("'", "''"), zipr.replace("'", "''") ) )
if left:
id += 1
else:
interpolationtype = "all";
ret.append( "select tigger_create_interpolation(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" %
- ( ",".join(llinestring), lfromadd, ltoadd, interpolationtype, name, county, zipl ) )
+ ( ",".join(llinestring), lfromadd.replace("'", "''"), ltoadd.replace("'", "''"), interpolationtype.replace("'", "''"), name.replace("'", "''"), county.replace("'", "''"), zipl.replace("'", "''") ) )
return ret