X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/bf77c721958da6e8f180e3664aee616514f0dc4e..c8e79397f5b71eae8fd7738c931f7f80b1228654:/utils/tigerAddressImport.py diff --git a/utils/tigerAddressImport.py b/utils/tigerAddressImport.py index b05b7394..5499f50e 100755 --- a/utils/tigerAddressImport.py +++ b/utils/tigerAddressImport.py @@ -197,32 +197,33 @@ county_fips = { '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' , +'02105' : 'Hoonah-Angoon Census Area, AK' , '02110' : 'Juneau, AK' , '02122' : 'Kenai Peninsula, AK' , '02130' : 'Ketchikan Gateway, AK' , '02150' : 'Kodiak Island, AK' , +'02158' : 'Kusilvak Census Area, AK' , '02164' : 'Lake and Peninsula, AK' , '02170' : 'Matanuska-Susitna, AK' , '02180' : 'Nome, AK' , '02185' : 'North Slope, AK' , '02188' : 'Northwest Arctic, AK' , -'02195' : 'Petersburg Census Area' , -'02198' : 'Prince of Wales-Hyder Census Area' , +'02195' : 'Petersburg, AK' , +'02198' : 'Prince of Wales-Hyder Census Area, AK' , '02201' : 'Prince of Wales-Outer Ketchikan, AK' , '02220' : 'Sitka, AK' , +'02230' : 'Skagway, AK' , '02232' : 'Skagway-Hoonah-Angoon, AK' , '02240' : 'Southeast Fairbanks, AK' , '02261' : 'Valdez-Cordova, AK' , '02270' : 'Wade Hampton, AK' , -'02275' : 'Wrangell City and Borough' , +'02275' : 'Wrangell City and Borough, AK' , '02280' : 'Wrangell-Petersburg, AK' , '02282' : 'Yakutat, AK' , '02290' : 'Yukon-Koyukuk, AK' , @@ -786,7 +787,7 @@ county_fips = { '17093' : 'Kendall, IL' , '17095' : 'Knox, IL' , '17097' : 'Lake, IL' , -'17099' : 'La Salle, IL' , +'17099' : 'LaSalle, IL' , '17101' : 'Lawrence, IL' , '17103' : 'Lee, IL' , '17105' : 'Livingston, IL' , @@ -1289,7 +1290,7 @@ county_fips = { '22053' : 'Jefferson Davis, LA' , '22055' : 'Lafayette, LA' , '22057' : 'Lafourche, LA' , -'22059' : 'La Salle, LA' , +'22059' : 'LaSalle, LA' , '22061' : 'Lincoln, LA' , '22063' : 'Livingston, LA' , '22065' : 'Madison, LA' , @@ -1365,7 +1366,7 @@ county_fips = { '24043' : 'Washington, MD' , '24045' : 'Wicomico, MD' , '24047' : 'Worcester, MD' , -'24510' : 'Baltimore city, MD' , +'24510' : 'Baltimore City, MD' , '25000' : 'MASSACHUSETTS' , '25001' : 'Barnstable, MA' , '25003' : 'Berkshire, MA' , @@ -1751,7 +1752,7 @@ county_fips = { '29225' : 'Webster, MO' , '29227' : 'Worth, MO' , '29229' : 'Wright, MO' , -'29510' : 'St. Louis city, MO' , +'29510' : 'St. Louis City, MO' , '30000' : 'MONTANA' , '30001' : 'Beaverhead, MT' , '30003' : 'Big Horn, MT' , @@ -1921,7 +1922,7 @@ county_fips = { '32029' : 'Storey, NV' , '32031' : 'Washoe, NV' , '32033' : 'White Pine, NV' , -'32510' : 'Carson City city, NV' , +'32510' : 'Carson City, NV' , '33000' : 'NEW HAMPSHIRE' , '33001' : 'Belknap, NH' , '33003' : 'Carroll, NH' , @@ -2583,6 +2584,7 @@ county_fips = { '46097' : 'Miner, SD' , '46099' : 'Minnehaha, SD' , '46101' : 'Moody, SD' , +'46102' : 'Oglala Lakota, SD' , '46103' : 'Pennington, SD' , '46105' : 'Perkins, SD' , '46107' : 'Potter, SD' , @@ -3326,97 +3328,97 @@ county_fips = { '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' , +'60010' : 'Eastern District, AS' , +'60020' : 'Manu\'a 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', +'69085' : 'Northern Islands, MP' , +'69100' : 'Rota, MP' , +'69110' : 'Saipan, MP' , +'69120' : 'Tinian, 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' , @@ -3891,8 +3893,8 @@ def addressways(waylist, nodelist, first_id): # ret.append( "" % (iSource, VERSION, import_guid) ) # ret.append( "" % (iAttrib) ) # ret.append( "" ) - - ret.append( "select tigger_create_interpolation(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" % + # call new tiger_line_import function to save the lines in the DB. + ret.append( "select tiger_line_import(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" % ( ",".join(rlinestring), rfromadd.replace("'", "''"), rtoadd.replace("'", "''"), interpolationtype.replace("'", "''"), name.replace("'", "''"), county.replace("'", "''"), zipr.replace("'", "''") ) ) if left: @@ -3917,7 +3919,7 @@ def addressways(waylist, nodelist, first_id): interpolationtype = "all"; else: interpolationtype = "all"; - ret.append( "select tigger_create_interpolation(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" % + ret.append( "select tiger_line_import(ST_GeomFromText('LINESTRING(%s)',4326), '%s', '%s', '%s', '%s', '%s', '%s');" % ( ",".join(llinestring), lfromadd.replace("'", "''"), ltoadd.replace("'", "''"), interpolationtype.replace("'", "''"), name.replace("'", "''"), county.replace("'", "''"), zipl.replace("'", "''") ) ) return ret