#!/usr/bin/python # # Copyright (c) 2007 Brian "Beej Jorgensen" Hall # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # import sys #-------------------------------------------------------------------- def writeGPXHeader(out=None, creator="tiger.py"): if out == None: out = sys.stdout out.write(""" """ % creator) #-------------------------------------------------------------------- def llToGPX(lat, lon, name, desc, sym, prefix=""): lat = llConvert(lat) lon = llConvert(lon) if lat == None or lon == None or name == "": return "" str = '\n' % (lat, lon) str += '\t%s%s\n' % (prefix, name) if desc != None: str += '\t%s\n' % desc str += '\t%s\n' % sym str += '\n' return str #-------------------------------------------------------------------- def writeGPXFooter(out=None): if out == None: out = sys.stdout out.write("\n") #-------------------------------------------------------------------- def llConvert(ll): if ll == '': return None if ll[0] == '-': minus = '-' else: minus = '' return "".join((minus, ll[1:-6] , ".", ll[-6:])) #-------------------------------------------------------------------- class CFCC(object): def __init__(self, id, desc, gpxsym=None): (self.id, self.desc, self.gpxsym) = (id, desc, gpxsym) #-------------------------------------------------------------------- cfcclist = { 'A11': CFCC('A11', 'Primary road with limited access or interstate highway, unseparated', None), 'A12': CFCC('A12', 'Primary road with limited access or interstate highway, unseparated, in tunnel', None), 'A13': CFCC('A13', 'Primary road with limited access or interstate highway, unseparated, underpassing', None), 'A14': CFCC('A14', 'Primary road with limited access or interstate highway, unseparated, with rail line in center', None), 'A15': CFCC('A15', 'Primary road with limited access or interstate highway, separated', None), 'A16': CFCC('A16', 'Primary road with limited access or interstate highway, separated, in tunnel', None), 'A17': CFCC('A17', 'Primary road with limited access or interstate highway, separated, underpassing', None), 'A18': CFCC('A18', 'Primary road with limited access or interstate highway, separated, with rail line in center', None), 'A21': CFCC('A21', 'Primary road without limited access, US highways, unseparated', None), 'A22': CFCC('A22', 'Primary road without limited access, US highways, unseparated, in tunnel', None), 'A23': CFCC('A23', 'Primary road without limited access, US highways, unseparated, underpassing', None), 'A24': CFCC('A24', 'Primary road without limited access, US highways, unseparated, with rail line in center', None), 'A25': CFCC('A25', 'Primary road without limited access, US highways, separated', None), 'A26': CFCC('A26', 'Primary road without limited access, US highways, separated, in tunnel', None), 'A27': CFCC('A27', 'Primary road without limited access, US highways, separated, underpassing', None), 'A28': CFCC('A28', 'Primary road without limited access, US highways, separated, with rail line in center', None), 'A31': CFCC('A31', 'Secondary and connecting road, state highways, unseparated', None), 'A32': CFCC('A32', 'Secondary and connecting road, state highways, unseparated, in tunnel', None), 'A33': CFCC('A33', 'Secondary and connecting road, state highways, unseparated, underpassing', None), 'A34': CFCC('A34', 'Secondary and connecting road, state highways, unseparated, with rail line in center', None), 'A35': CFCC('A35', 'Secondary and connecting road, state highways, separated', None), 'A36': CFCC('A36', 'Secondary and connecting road, state highways, separated, in tunnel', None), 'A37': CFCC('A37', 'Secondary and connecting road, state and county highways, separated, underpassing', None), 'A38': CFCC('A38', 'Secondary and connecting road, state and county highway, separated, with rail line in center', None), 'A41': CFCC('A41', 'Local, neighborhood, and rural road, city street, unseparated', None), 'A42': CFCC('A42', 'Local, neighborhood, and rural road, city street, unseparated, in tunnel', None), 'A43': CFCC('A43', 'Local, neighborhood, and rural road, city street, unseparated, underpassing', None), 'A44': CFCC('A44', 'Local, neighborhood, and rural road, city street, unseparated, with rail line in center', None), 'A45': CFCC('A45', 'Local, neighborhood, and rural road, city street, separated', None), 'A46': CFCC('A46', 'Local, neighborhood, and rural road, city street, separated, in tunnel', None), 'A47': CFCC('A47', 'Local, neighborhood, and rural road, city street, separated, underpassing', None), 'A48': CFCC('A48', 'Local, neighborhood, and rural road, city street, separated, with rail line in center', None), 'A51': CFCC('A51', 'Vehicular trail, road passable only by 4WD vehicle, unseparated', None), 'A52': CFCC('A52', 'Vehicular trail, road passable only by 4WD vehicle, unseparated, in tunnel', None), 'A53': CFCC('A53', 'Vehicular trail, road passable only by 4WD vehicle, unseparated, underpassing', None), 'A60': CFCC('A60', 'Special road feature, major category used when the minor category could not be determined', None), 'A61': CFCC('A61', 'Cul-de-sac, the closed end of a road that forms a loop or turn-around', None), 'A62': CFCC('A62', 'Traffic circle, the portion of a road or intersection of roads forming a roundabout', None), 'A63': CFCC('A63', 'Access ramp, the portion of a road that forms a cloverleaf or limited-access interchange', None), 'A64': CFCC('A64', 'Service drive, the road or portion of a road that provides access to businesses, facilities, and rest areas along a limited-access highway; this frontage road may intersect other roads and be named', None), 'A65': CFCC('A65', 'Ferry crossing, the representation of a route over water that connects roads on opposite shores; used by ships carrying automobiles or people', None), 'A70': CFCC('A70', 'Other thoroughfare, major category used when the minor category could not be determined', None), 'A71': CFCC('A71', 'Walkway or trail for pedestrians, usually unnamed', None), 'A72': CFCC('A72', 'Stairway, stepped road for pedestrians, usually unnamed', None), 'A73': CFCC('A73', 'Alley, road for service vehicles, usually unnamed, located at the rear of buildings and property', None), 'A74': CFCC('A74', 'Driveway or service road, usually privately owned and unnamed, used as access to residences, trailer parks, and apartment complexes, or as access to logging areas, oil rigs, ranches, farms, and park lands', None), 'B11': CFCC('B11', 'Railroad main track, not in tunnel or underpassing', None), 'B12': CFCC('B12', 'Railroad main track, in tunnel', None), 'B13': CFCC('B13', 'Railroad main track, underpassing', None), 'B21': CFCC('B21', 'Railroad spur track, not in tunnel or underpassing', None), 'B22': CFCC('B22', 'Railroad spur track, in tunnel', None), 'B23': CFCC('B23', 'Railroad spur track, underpassing', None), 'B31': CFCC('B31', 'Railroad yard track, not in tunnel or underpassing', None), 'B32': CFCC('B32', 'Railroad yard track, in tunnel', None), 'B33': CFCC('B33', 'Railroad yard track, underpassing', None), 'B40': CFCC('B40', 'Railroad ferry crossing, the representation of a route over water used by ships carrying train cars to connecting railroads on opposite shores.', None), 'B50': CFCC('B50', 'Other rail line; major category used alone when the minor category could not be determined', None), 'B51': CFCC('B51', 'Carline, a track for streetcars, trolleys, and other mass transit rail systems; used when the carline is not part of the road right-of-way', None), 'B52': CFCC('B52', 'Cog railroad, incline railway, or logging tram', None), 'C00': CFCC('C00', 'Miscellaneous ground transportation, not road or railroad; major and minor categories unknown', None), 'C10': CFCC('C10', 'Pipeline; major category used alone', None), 'C20': CFCC('C20', 'Power transmission line; major category used alone', None), 'C30': CFCC('C30', 'Other ground transportation that is not a pipeline or a power transmission line; major category used alone when minor category could not be determined', None), 'C31': CFCC('C31', 'Aerial tramway, monorail, or ski lift', None), 'D00': CFCC('D00', 'Landmark feature, classification unknown, or not elsewhere classified', 'wpt_dot'), 'D10': CFCC('D10', 'Military installation', 'military'), 'D20': CFCC('D20', 'Multihousehold and transient quarters', 'building'), 'D21': CFCC('D21', 'Apartment building or complex', 'building'), 'D22': CFCC('D22', 'Rooming or boarding house', 'building'), 'D23': CFCC('D23', 'Trailer court or mobile home park', 'rv_park'), 'D24': CFCC('D24', 'Marina', 'boat_ramp'), 'D25': CFCC('D25', 'Crew-of-vessel area', 'wpt_dot'), 'D26': CFCC('D26', 'Housing facility for workers', 'building'), 'D27': CFCC('D27', 'Hotel, motel, resort, spa, YMCA, or YWCA', 'building'), 'D28': CFCC('D28', 'Campground', 'camp'), 'D29': CFCC('D29', 'Shelter or mission', 'building'), 'D30': CFCC('D30', 'Custodial facility', 'building'), 'D31': CFCC('D31', 'Hospital', '1st_aid'), 'D32': CFCC('D32', 'Halfway house', 'building'), 'D33': CFCC('D33', 'Nursing home, retirement home, or home for the aged', 'building'), 'D34': CFCC('D34', 'County home or poor farm', 'house'), 'D35': CFCC('D35', 'Orphanage', 'building'), 'D36': CFCC('D36', 'Jail or detention center', 'building'), 'D37': CFCC('D37', 'Federal penitentiary, state prison, or prison farm', 'building'), 'D40': CFCC('D40', 'Educational or religious institution', 'school'), 'D41': CFCC('D41', 'Sorority or fraternity', 'building'), 'D42': CFCC('D42', 'Convent or monastery', 'church'), 'D43': CFCC('D43', 'Educational institution', 'school'), 'D44': CFCC('D44', 'Religious institution', 'church'), 'D50': CFCC('D50', 'Transportation terminal ', 'building'), 'D51': CFCC('D51', 'Airport or airfield ', 'airport'), 'D52': CFCC('D52', 'Train station ', 'building'), 'D53': CFCC('D53', 'Bus terminal ', 'building'), 'D54': CFCC('D54', 'Marine terminal ', 'building'), 'D55': CFCC('D55', 'Seaplane anchorage ', 'seaplane'), 'D60': CFCC('D60', 'Employment center ', 'building'), 'D61': CFCC('D61', 'Shopping center or major retail center ', 'store'), 'D62': CFCC('D62', 'Industrial building or industrial park ', 'building'), 'D63': CFCC('D63', 'Office building or office park ', 'building'), 'D64': CFCC('D64', 'Amusement center ', 'amuse_pk'), 'D65': CFCC('D65', 'Government center ', 'building'), 'D66': CFCC('D66', 'Other employment center ', 'building'), 'D70': CFCC('D70', 'Tower ', 'tall_tower'), 'D71': CFCC('D71', 'Lookout tower ', 'short_tower'), 'D80': CFCC('D80', 'Open space ', 'geo_place_lnd'), 'D81': CFCC('D81', 'Golf course ', 'golf'), 'D82': CFCC('D82', 'Cemetery ', 'cemetary'), 'D83': CFCC('D83', 'National Park Service area ', 'park'), 'D84': CFCC('D84', 'National forest or other federal land ', 'geo_place_lnd'), 'D85': CFCC('D85', 'State or local park or forest ', 'park'), 'D90': CFCC('D90', 'Special purpose landmark ', 'wpt_dot'), 'D91': CFCC('D91', 'Post office ', 'post_ofc'), 'D92': CFCC('D92', 'Urbanizacion, an identifiable community development in Puerto Rico ', 'wpt_dot'), 'H00': CFCC('H00', 'Water feature, classification unknown, or not elsewhere classified ', 'wpt_dot'), 'H11': CFCC('H11', 'Perennial stream or river ', 'geo_place_wtr'), 'H12': CFCC('H12', 'Intermittent stream, river, or wash ', 'geo_place_wtr'), 'H13': CFCC('H13', 'Braided stream or river ', 'geo_place_wtr'), 'H21': CFCC('H21', 'Perennial canal, ditch, or aqueduct ', 'geo_place_wtr'), 'H22': CFCC('H22', 'Intermittent canal, ditch, or aqueduct ', 'geo_place_wtr'), 'H31': CFCC('H31', 'Perennial lake or pond ', 'geo_place_wtr'), 'H32': CFCC('H32', 'Intermittent lake or pond ', 'geo_place_wtr'), 'H41': CFCC('H41', 'Perennial reservoir', 'geo_place_wtr'), 'H42': CFCC('H42', 'Intermittent reservoir', 'geo_place_wtr'), 'H50': CFCC('H50', 'Bay, estuary gulf, sound, sea, or ocean', 'geo_place_wtr'), 'H51': CFCC('H51', 'Bay, estuary gulf, or sound', 'wpt_dot'), 'H53': CFCC('H53', 'Sea, or ocean', 'geo_place_wtr'), 'H60': CFCC('H60', 'Gravel pit or quarry filled with water', 'geo_place_wtr'), 'H80': CFCC('H80', 'Special water feature', 'geo_place_wtr'), 'H81': CFCC('H81', 'Glacier', 'geo_place_wtr'), } #-------------------------------------------------------------------- class BaseRT(object): def __init__(self, raw): if raw != None: self.parseRaw(raw) else: for r in self.recinfo: setattr(self, r[0], None) def parseRaw(self, raw): for r in self.recinfo: setattr(self, r[0], raw[(r[1]-1):r[2]].strip()) # BEGIN mkdd-generated code ########################################## #-------------------------------------------------------------------- # TIGER Record Type 1: Complete Chain Basic Data Record # # Field BV Fmt Type Beg End Len Description # -------- --- --- ---- --- --- --- -------------------------------------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # SIDE1 Yes R N 16 16 1 Single-Side Complete Chain Code # SOURCE Yes L A 17 17 1 Linear Segment Source Code # FEDIRP Yes L A 18 19 2 Feature Direction, Prefix # FENAME Yes L A 20 49 30 Feature Name # FETYPE Yes L A 50 53 4 Feature Type # FEDIRS Yes L A 54 55 2 Feature Direction, Suffix # CFCC Yes L A 56 58 3 Census Feature Class Code # FRADDL Yes R A 59 69 11 Start Address, Left # TOADDL Yes R A 70 80 11 End Address, Left # FRADDR Yes R A 81 91 11 Start Address, Right # TOADDR Yes R A 92 102 11 End Address, Right # FRIADDL Yes L A 103 103 1 Start Imputed Address Flag, Left # TOIADDL Yes L A 104 104 1 End Imputed Address Flag, Left # FRIADDR Yes L A 105 105 1 Start Imputed Address Flag, Right # TOIADDR Yes L A 106 106 1 End Imputed Address Flag, Right # ZIPL Yes L N 107 111 5 ZIP Code, Left # ZIPR Yes L N 112 116 5 ZIP Code, Right # AIANHHL Yes L N 117 121 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Left # AIANHHR Yes L N 122 126 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Right # AIHHTLIL Yes L A 127 127 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 Left # AIHHTLIR Yes L A 128 128 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 Right # CENSUS1 Yes L A 129 129 1 Census Use 1 # CENSUS2 Yes L A 130 130 1 Census Use 2 # STATEL Yes L N 131 132 2 FIPS State Code, 2000 Left # STATER Yes L N 133 134 2 FIPS State Code, 2000 Right # COUNTYL Yes L N 135 137 3 FIPS County Code, 2000 Left # COUNTYR Yes L N 138 140 3 FIPS County Code, 2000 Right # COUSUBL Yes L N 141 145 5 FIPS 55 Code (County Subdivision), 2000 Left # COUSUBR Yes L N 146 150 5 FIPS 55 Code (County Subdivision), 2000 Right # SUBMCDL Yes L N 151 155 5 FIPS 55 Code (Subbarrio), 2000 Left # SUBMCDR Yes L N 156 160 5 FIPS 55 Code (Subbarrio), 2000 Right # PLACEL Yes L N 161 165 5 FIPS 55 Code (Place/CDP), 2000 Left # PLACER Yes L N 166 170 5 FIPS 55 Code (Place/CDP), 2000 Right # TRACTL Yes L N 171 176 6 Census Tract Code, 2000 Left # TRACTR Yes L N 177 182 6 Census Tract Code, 2000 Right # BLOCKL Yes L N 183 186 4 Census Block Number, 2000 Left # BLOCKR Yes L N 187 190 4 Census Block Number, 2000 Right # FRLONG No R N 191 200 10 Start Longitude # FRLAT No R N 201 209 9 Start Latitude # TOLONG No R N 210 219 10 End Longitude # TOLAT No R N 220 228 9 End Latitude # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT1(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['side1', 16, 16], ['source', 17, 17], ['fedirp', 18, 19], ['fename', 20, 49], ['fetype', 50, 53], ['fedirs', 54, 55], ['cfcc', 56, 58], ['fraddl', 59, 69], ['toaddl', 70, 80], ['fraddr', 81, 91], ['toaddr', 92, 102], ['friaddl', 103, 103], ['toiaddl', 104, 104], ['friaddr', 105, 105], ['toiaddr', 106, 106], ['zipl', 107, 111], ['zipr', 112, 116], ['aianhhl', 117, 121], ['aianhhr', 122, 126], ['aihhtlil', 127, 127], ['aihhtlir', 128, 128], ['census1', 129, 129], ['census2', 130, 130], ['statel', 131, 132], ['stater', 133, 134], ['countyl', 135, 137], ['countyr', 138, 140], ['cousubl', 141, 145], ['cousubr', 146, 150], ['submcdl', 151, 155], ['submcdr', 156, 160], ['placel', 161, 165], ['placer', 166, 170], ['tractl', 171, 176], ['tractr', 177, 182], ['blockl', 183, 186], ['blockr', 187, 190], ['frlong', 191, 200], ['frlat', 201, 209], ['tolong', 210, 219], ['tolat', 220, 228], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 2: Complete Chain Shape Coordinates # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # RTSQ No R N 16 18 3 Record Sequence Number # LONG1 No R N 19 28 10 Point 1, Longitude # LAT1 No R N 29 37 9 Point 1, Latitude # LONG2 Yes R N 38 47 10 Point 2, Longitude # LAT2 Yes R N 48 56 9 Point 2, Latitude # LONG3 Yes R N 57 66 10 Point 3, Longitude # LAT3 Yes R N 67 75 9 Point 3, Latitude # LONG4 Yes R N 76 85 10 Point 4, Longitude # LAT4 Yes R N 86 94 9 Point 4, Latitude # LONG5 Yes R N 95 104 10 Point 5, Longitude # LAT5 Yes R N 105 113 9 Point 5, Latitude # LONG6 Yes R N 114 123 10 Point 6, Longitude # LAT6 Yes R N 124 132 9 Point 6, Latitude # LONG7 Yes R N 133 142 10 Point 7, Longitude # LAT7 Yes R N 143 151 9 Point 7, Latitude # LONG8 Yes R N 152 161 10 Point 8, Longitude # LAT8 Yes R N 162 170 9 Point 8, Latitude # LONG9 Yes R N 171 180 10 Point 9, Longitude # LAT9 Yes R N 181 189 9 Point 9, Latitude # LONG10 Yes R N 190 199 10 Point 10, Longitude # LAT10 Yes R N 200 208 9 Point 10, Latitude # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT2(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['rtsq', 16, 18], ['long1', 19, 28], ['lat1', 29, 37], ['long2', 38, 47], ['lat2', 48, 56], ['long3', 57, 66], ['lat3', 67, 75], ['long4', 76, 85], ['lat4', 86, 94], ['long5', 95, 104], ['lat5', 105, 113], ['long6', 114, 123], ['lat6', 124, 132], ['long7', 133, 142], ['lat7', 143, 151], ['long8', 152, 161], ['lat8', 162, 170], ['long9', 171, 180], ['lat9', 181, 189], ['long10', 190, 199], ['lat10', 200, 208], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 3: Complete Chain Geographic Entity Codes # # Field BV Fmt Type Beg End Len Description # ----------- --- --- ---- --- --- --- -------------------------------------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # STATE90L Yes L N 16 17 2 FIPS State Code, 1990 Left # STATE90R Yes L N 18 19 2 FIPS State Code, 1990 Right # COUNTY90L Yes L N 20 22 3 FIPS County Code, 1990 Left # COUNTY90R Yes L N 23 25 3 FIPS County Code, 1990 Right # COUSUB90L Yes L N 26 30 5 FIPS 55 Code (County Subdivision), 1990 Left # COUSUB90R Yes L N 31 35 5 FIPS 55 Code (County Subdivision), 1990 Right # PLACE90L Yes L N 36 40 5 FIPS 55 Code (Place/CDP), 1990 Left # PLACE90R Yes L N 41 45 5 FIPS 55 Code (Place/CDP), 1990 Right # TRACT90L Yes L N 46 51 6 Census Tract/BNA Code, 1990 Left # TRACT90R Yes L N 52 57 6 Census Tract/BNA Code, 1990 Right # AIANHHCE90L Yes L N 58 61 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 Left # AIANHHCE90R Yes L N 62 65 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 Right # AIHHTLI90L Yes L A 66 66 1 American Indian/Hawaiian Home Land* Trust Land Indicator, 1990 Left # AIHHTLI90R Yes L A 67 67 1 American Indian /Hawaiian Home Land* Trust Land Indicator, 1990 Right # RS1 Yes L A 68 69 2 Reserved Space 1 # BLOCK90L Yes L A 70 73 4 Census Block Number, 1990 Left # BLOCK90R Yes L A 74 77 4 Census Block Number, 1990 Right # AIANHHCEL Yes L N 78 81 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Left # AIANHHCER Yes L N 82 85 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 2000 Right # ANRCL Yes L N 86 90 5 FIPS 55 Code (ANRC), 2000 Left # ANRCR Yes L N 91 95 5 FIPS 55 Code (ANRC), 2000 Right # AITSCEL Yes L N 96 98 3 Census Code (American Indian Tribal Subdivision), 2000 Left # AITSCER Yes L N 99 101 3 Census Code (American Indian Tribal Subdivision), 2000 Right # AITSL Yes L N 102 106 5 FIPS 55 Code (American Indian Tribal Subdivision), 2000 Left # AITSR Yes L N 107 111 5 FIPS 55 Code (American Indian Tribal Subdivision), 2000 Right # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT3(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['state90l', 16, 17], ['state90r', 18, 19], ['county90l', 20, 22], ['county90r', 23, 25], ['cousub90l', 26, 30], ['cousub90r', 31, 35], ['place90l', 36, 40], ['place90r', 41, 45], ['tract90l', 46, 51], ['tract90r', 52, 57], ['aianhhce90l', 58, 61], ['aianhhce90r', 62, 65], ['aihhtli90l', 66, 66], ['aihhtli90r', 67, 67], ['rs1', 68, 69], ['block90l', 70, 73], ['block90r', 74, 77], ['aianhhcel', 78, 81], ['aianhhcer', 82, 85], ['anrcl', 86, 90], ['anrcr', 91, 95], ['aitscel', 96, 98], ['aitscer', 99, 101], ['aitsl', 102, 106], ['aitsr', 107, 111], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 4: Index to Alternate Feature Identifiers # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # RTSQ No R N 16 18 3 Record Sequence Number # FEAT1 No R N 19 26 8 Line Additional Name Identification Number, First # FEAT2 Yes R N 27 34 8 Line Additional Name Identification Number, Second # FEAT3 Yes R N 35 42 8 Line Additional Name Identification Number, Third # FEAT4 Yes R N 43 50 8 Line Additional Name Identification Number, Fourth # FEAT5 Yes R N 51 58 8 Line Additional Name Identification Number, Fifth # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT4(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['rtsq', 16, 18], ['feat1', 19, 26], ['feat2', 27, 34], ['feat3', 35, 42], ['feat4', 43, 50], ['feat5', 51, 58], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 5: Complete Chain Feature Identifiers # # Field BV Fmt Type Beg End Len Description # ------ --- --- ---- --- --- --- ------------------------------- # RT No L A 1 1 1 Record Type # FILE No L N 2 6 5 File Code # FEAT No R N 7 14 8 Line Name Identification Number # FEDIRP Yes L A 15 16 2 Feature Direction, Prefix # FENAME Yes L A 17 46 30 Feature Name # FETYPE Yes L A 47 50 4 Feature Type # FEDIRS Yes L A 51 52 2 Feature Direction, Suffix # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT5(BaseRT): recinfo = [ ['rt', 1, 1], ['file', 2, 6], ['feat', 7, 14], ['fedirp', 15, 16], ['fename', 17, 46], ['fetype', 47, 50], ['fedirs', 51, 52], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 6: Additional Address Range and ZIP Code Data # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # RTSQ No R N 16 18 3 Record Sequence Number # FRADDL Yes R A 19 29 11 Start Address, Left # TOADDL Yes R A 30 40 11 End Address, Left # FRADDR Yes R A 41 51 11 Start Address, Right # TOADDR Yes R A 52 62 11 End Address, Right # FRIADDL Yes L A 63 63 1 Start Imputed Address Flag, Left # TOIADDL Yes L A 64 64 1 End Imputed Address Flag, Left # FRIADDR Yes L A 65 65 1 Start Imputed Address Flag, Right # TOIADDR Yes L A 66 66 1 End Imputed Address Flag, Right # ZIPL Yes L N 67 71 5 ZIP Code, Left # ZIPR Yes L N 72 76 5 ZIP Code, Right # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT6(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['rtsq', 16, 18], ['fraddl', 19, 29], ['toaddl', 30, 40], ['fraddr', 41, 51], ['toaddr', 52, 62], ['friaddl', 63, 63], ['toiaddl', 64, 64], ['friaddr', 65, 65], ['toiaddr', 66, 66], ['zipl', 67, 71], ['zipr', 72, 76], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 7: Landmark Features # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- ------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # LAND No R N 11 20 10 Landmark Identification Number # SOURCE Yes L A 21 21 1 Source or First Source Code to Update # CFCC Yes L A 22 24 3 Census Feature Class Code # LANAME Yes L A 25 54 30 Landmark Name # LALONG Yes R N 55 64 10 Longitude # LALAT Yes R N 65 73 9 Latitude # FILLER Yes L A 74 74 1 Filler (to make even character count) # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT7(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['land', 11, 20], ['source', 21, 21], ['cfcc', 22, 24], ['laname', 25, 54], ['lalong', 55, 64], ['lalat', 65, 73], ['filler', 74, 74], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 8: Polygons Linked to Area Landmarks # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- ------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # POLYID No R N 16 25 10 Polygon Identification Code # LAND No R N 26 35 10 Landmark Identification Number # FILLER Yes L A 36 36 1 Filler (to make even character count) # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT8(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['polyid', 16, 25], ['land', 26, 35], ['filler', 36, 36], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type 9: Key Geographic Location Features # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- ------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # POLYID No R N 16 25 10 Polygon Identification Code # SOURCE Yes L A 26 26 1 Source or First Source Code to Update # CFCC Yes L A 27 29 3 Census Feature Class Code # KGLNAME Yes L A 30 59 30 Key Geographic Location Name # KGLADD Yes R A 60 70 11 Key Geographic Location Address # KGLZIP Yes L N 71 75 5 Key Geographic Location ZIP Code # KGLZIP4 Yes L N 76 79 4 +4 Postal Add-On Code for KGL # FEAT Yes R N 80 87 8 Line Name Identification Number # FILLER Yes L A 88 88 1 Filler (to make even character count) # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RT9(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['polyid', 16, 25], ['source', 26, 26], ['cfcc', 27, 29], ['kglname', 30, 59], ['kgladd', 60, 70], ['kglzip', 71, 75], ['kglzip4', 76, 79], ['feat', 80, 87], ['filler', 88, 88], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type A: Polygon Geographic Entity Codes # # Field BV Fmt Type Beg End Len Description # ---------- --- --- ---- --- --- --- --------------------------------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # POLYID No R N 16 25 10 Polygon Identification Code # AIANHH90 Yes L N 26 30 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 # COUSUB90 Yes L N 31 35 5 FIPS 55 Code (County Subdivision), 1990 # PLACE90 Yes L N 36 40 5 FIPS 55 Code (Place/CDP), 1990 # TRACT90 Yes L N 41 46 6 Census Tract/BNA Code, 1990 # BLOCK90 Yes L A 47 50 4 Census Block Number, 1990 # CD106 Yes R N 51 52 2 Congressional District Code, 106th # CD108 Yes R N 53 54 2 Congressional District Code, 108th (not filled) # SDELM Yes L A 55 59 5 School District Code, Elementary School # PUMA1 Yes L N 60 64 5 Public Use Microdata Area File, 1990 # SDSEC Yes L A 65 69 5 School District Code, Secondary School # SDUNI Yes L A 70 74 5 School District Code, Unified District # TAZ Yes R A 75 80 6 Traffic Analysis Zone Code, 2000 # UA90 Yes L N 81 84 4 Census Urbanized Area Code, 1990 # UR90 Yes L A 85 85 1 Urban/Rural Indicator, 1990 # RS5 Yes L A 86 89 4 Reserved Space 5 # STATE90 Yes L N 90 91 2 FIPS State Code, 1990 # COUNTY90 Yes L N 92 94 3 FIPS County Code, 1990 # AIANHHCE90 Yes L N 95 98 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTA(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['polyid', 16, 25], ['aianhh90', 26, 30], ['cousub90', 31, 35], ['place90', 36, 40], ['tract90', 41, 46], ['block90', 47, 50], ['cd106', 51, 52], ['cd108', 53, 54], ['sdelm', 55, 59], ['puma1', 60, 64], ['sdsec', 65, 69], ['sduni', 70, 74], ['taz', 75, 80], ['ua90', 81, 84], ['ur90', 85, 85], ['rs5', 86, 89], ['state90', 90, 91], ['county90', 92, 94], ['aianhhce90', 95, 98], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type C: Geographic Entity Names # # Field BV Fmt Type Beg End Len Description # -------- --- --- ---- --- --- --- ----------------------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # STATE Yes L N 6 7 2 FIPS State Code # COUNTY Yes L N 8 10 3 FIPS County Code # DATAYR Yes L N 11 14 4 FIPS Code, Name, and/or Attribute Data Applicable Year # FIPS Yes L N 15 19 5 FIPS PUB 55-3 Code # FIPSCC Yes L A 20 21 2 FIPS 55 Class Code # PLACEDC Yes L A 22 22 1 Place Description Code # LSADC Yes L A 23 24 2 Legal/Statistical Area Description Code # ENTITY No L A 25 25 1 Entity Type Code # MA Yes L N 26 29 4 Metropolitan Area Code # SD Yes L N 30 34 5 School District Code # AIANHHCE Yes L N 35 38 4 Census American Indian/Alaska Native Area/Hawaiian Home Land Code # VTDTRACT Yes R A 39 44 6 Census Voting District Code/Census Tract Code # UAUGA Yes L N 45 49 5 Census Urban Area Code*/Urban Growth Area Code # AITSCE Yes L N 50 52 3 Census American Indian Tribal Subdivision Code # NAME No L A 53 112 60 Name of Geographic Area # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTC(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['state', 6, 7], ['county', 8, 10], ['datayr', 11, 14], ['fips', 15, 19], ['fipscc', 20, 21], ['placedc', 22, 22], ['lsadc', 23, 24], ['entity', 25, 25], ['ma', 26, 29], ['sd', 30, 34], ['aianhhce', 35, 38], ['vtdtract', 39, 44], ['uauga', 45, 49], ['aitsce', 50, 52], ['name', 53, 112], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type H: TIGER/Line ID History # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # TLID No R N 11 20 10 TIGER/Line ID, Permanent Record Number # HIST Yes L A 21 21 1 History or Last Source Code to Update # SOURCE No L A 22 22 1 Source or First Source Code to Update # TLIDFR1 Yes R N 23 32 10 TIGER/Line ID, Created From Number 1 # TLIDFR2 Yes R N 33 42 10 TIGER/Line ID, Created From Number 2 # TLIDTO1 Yes R N 43 52 10 TIGER/Line ID, Became Number 1 # TLIDTO2 Yes R N 53 62 10 TIGER/Line ID, Became Number 2 # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTH(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['tlid', 11, 20], ['hist', 21, 21], ['source', 22, 22], ['tlidfr1', 23, 32], ['tlidfr2', 33, 42], ['tlidto1', 43, 52], ['tlidto2', 53, 62], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type I: Link Between Complete Chains and Polygons # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # FILE No L N 16 20 5 File Code # RTLINK No L A 21 21 1 Record Type of Link # CENIDL Yes L A 22 26 5 Census File Identification Code, Left # POLYIDL Yes R N 27 36 10 Polygon Identification Code, Left # CENIDR Yes L A 37 41 5 Census File Identification Code, Right # POLYIDR Yes R N 42 51 10 Polygon Identification Code, Right # FILLER Yes L A 52 52 1 Filler (to make even character count) # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTI(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['file', 16, 20], ['rtlink', 21, 21], ['cenidl', 22, 26], ['polyidl', 27, 36], ['cenidr', 37, 41], ['polyidr', 42, 51], ['filler', 52, 52], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type P: Polygon Internal Point # # Field BV Fmt Type Beg End Len Description # -------- -- --- ---- --- --- --- -------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # POLYID No R N 16 25 10 Polygon Identification Code # POLYLONG No R N 26 35 10 Polygon Internal Point Longitude # POLYLAT No R N 36 44 9 Polygon Internal Point Latitude # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTP(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['polyid', 16, 25], ['polylong', 26, 35], ['polylat', 36, 44], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type R: TIGER/Line ID Record Number Range # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- --------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # MAXID No R N 16 25 10 TIGER/Line ID, Maximum Permanent ID for Census File # MINID No R N 26 35 10 TIGER/Line ID, Minimum Permanent ID for Census File # HIGHID No R N 36 45 10 TIGER/Line ID, Current High ID for Census File # FILLER Yes L A 46 46 1 Filler (to make even character count) # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTR(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['maxid', 16, 25], ['minid', 26, 35], ['highid', 36, 45], ['filler', 46, 46], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type S: Polygon Additional Geographic Entity Codes # # Field BV Fmt Type Beg End Len Description # --------- --- --- ---- --- --- --- ---------------------------------------------------------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # FILE No L N 6 10 5 File Code # CENID No L A 11 15 5 Census File Identification Code # POLYID No R N 16 25 10 Polygon Identification Code # WATER Yes L N 26 26 1 Water Flag # MSACMSA Yes L N 27 30 4 FIPS Consolidated Metropolitan Statistical Area/Metropolitan Statistical Area Code, 2000 # PMSA Yes L N 31 34 4 FIPS Primary Metropolitan Statistical Area Code, 2000 # AIANHH Yes L N 35 39 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 # AIANHHCE Yes L N 40 43 4 Census Code (American Indian/ Alaska Native Area/Hawaiian Home Land), 2000 # AIHHTLI Yes L A 44 44 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 # RS6 Yes L A 45 46 2 Reserved Space 6 # STATE Yes L N 47 48 2 FIPS State Code, 2000 # COUNTY Yes L N 49 51 3 FIPS County Code, 2000 # CONCIT Yes L N 52 56 5 FIPS 55 Code (Consolidated City), 2000 # COUSUB Yes L N 57 61 5 FIPS 55 Code (County Subdivision), 2000 # SUBMCD Yes L N 62 66 5 FIPS 55 Code (Subbarrio), 2000 # PLACE Yes L N 67 71 5 FIPS 55 Code (Incorporated Place/CDP), 2000 # TRACT Yes L N 72 77 6 Census Tract Code, 2000 # BLOCK Yes L N 78 81 4 Census Block Number, 2000 # CENSUS6 Yes R N 82 82 1 Census Use 6 # CDCU Yes R N 83 84 2 Congressional District Code, Current # SLDU Yes R A 85 87 3 State Legislative District Code (Upper Chamber), 2000 # SLDL Yes R A 88 90 3 State Legislative District Code (Lower Chamber), 2000 # UGA Yes L A 91 95 5 Oregon Urban Growth Area, 2000 # BLKGRP Yes L N 96 96 1 Census Block Group, 2000 # VTD Yes R A 97 102 6 Census Voting District Code, 2000 # STATECOL Yes L N 103 104 2 Census 2000 Collection State FIPS Code # COUNTYCOL Yes L N 105 107 3 Census 2000 Collection County FIPS Code # BLOCKCOL Yes R N 108 112 5 Census 2000 Collection Block Number # BLKSUFCOL Yes L A 113 113 1 Census 2000 Collection Block Number Suffix # ZCTA5 Yes L A 114 118 5 ZIP Code Tabulation Area, 2000 # RS8 Yes L A 119 120 2 Reserved Space 8 # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTS(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['file', 6, 10], ['cenid', 11, 15], ['polyid', 16, 25], ['water', 26, 26], ['msacmsa', 27, 30], ['pmsa', 31, 34], ['aianhh', 35, 39], ['aianhhce', 40, 43], ['aihhtli', 44, 44], ['rs6', 45, 46], ['state', 47, 48], ['county', 49, 51], ['concit', 52, 56], ['cousub', 57, 61], ['submcd', 62, 66], ['place', 67, 71], ['tract', 72, 77], ['block', 78, 81], ['census6', 82, 82], ['cdcu', 83, 84], ['sldu', 85, 87], ['sldl', 88, 90], ['uga', 91, 95], ['blkgrp', 96, 96], ['vtd', 97, 102], ['statecol', 103, 104], ['countycol', 105, 107], ['blockcol', 108, 112], ['blksufcol', 113, 113], ['zcta5', 114, 118], ['rs8', 119, 120], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) #-------------------------------------------------------------------- # TIGER Record Type Z: ZIP+4 Codes # # Field BV Fmt Type Beg End Len Description # ------- --- --- ---- --- --- --- -------------------------------------- # RT No L A 1 1 1 Record Type # VERSION No L N 2 5 4 Version Number # TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number # RTSQ No R N 16 18 3 Record Sequence Number # ZIP4L Yes L N 19 22 4 +4 Postal Add-On Code, Left # ZIP4R Yes L N 23 26 4 +4 Postal Add-On Code, Right # # BV (Blank Value): # Yes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # L = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # R = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # A = Alphanumeric, N = Numeric class RTZ(BaseRT): recinfo = [ ['rt', 1, 1], ['version', 2, 5], ['tlid', 6, 15], ['rtsq', 16, 18], ['zip4l', 19, 22], ['zip4r', 23, 26], ] def __init__(self, raw=None): BaseRT.__init__(self, raw) # END mkdd-generated code ############################################ #-------------------------------------------------------------------- class RecDB(list): def __init__(self, cls, indexfieldlist=None): self.cls = cls if indexfieldlist == None: indexfieldlist = [] self.indexfieldlist = indexfieldlist for i in self.indexfieldlist: setattr(self, i, {}) def load(self, filename): fp = file(filename) for line in fp: r = self.cls.__new__(self.cls) r.__init__(line) self.insert(r) fp.close() def insert(self, r): for i in self.indexfieldlist: index = getattr(self, i) key = getattr(r, i) index[key] = r self.append(r) def select(self, index, key): if index in self.indexfieldlist: i = getattr(self, index) return i[key] else: # slow linear search for r in self: if getattr(r, index) == key: return r return None #==================================================================== def main(argv): return 0 if __name__ == "__main__": sys.exit(main(sys.argv))