1 : /******************************************************************************
2 : * $Id: tigerzipcodes.cpp 22961 2011-08-20 17:09:59Z rouault $
3 : *
4 : * Project: TIGER/Line Translator
5 : * Purpose: Implements TigerZipCodes, providing access to .RT6 files.
6 : * Author: Frank Warmerdam, warmerdam@pobox.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1999, Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #include "ogr_tiger.h"
31 : #include "cpl_conv.h"
32 :
33 : CPL_CVSID("$Id: tigerzipcodes.cpp 22961 2011-08-20 17:09:59Z rouault $");
34 :
35 : #define FILE_CODE "6"
36 :
37 : static const TigerFieldInfo rt6_fields[] = {
38 : // fieldname fmt type OFTType beg end len bDefine bSet bWrite
39 : { "MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0, 0 },
40 : { "TLID", 'R', 'N', OFTInteger, 6, 15, 10, 1, 1, 1 },
41 : { "RTSQ", 'R', 'N', OFTInteger, 16, 18, 3, 1, 1, 1 },
42 : { "FRADDL", 'R', 'A', OFTString, 19, 29, 11, 1, 1, 1 },
43 : { "TOADDL", 'R', 'A', OFTString, 30, 40, 11, 1, 1, 1 },
44 : { "FRADDR", 'R', 'A', OFTString, 41, 51, 11, 1, 1, 1 },
45 : { "TOADDR", 'R', 'A', OFTString, 52, 62, 11, 1, 1, 1 },
46 : { "FRIADDL", 'L', 'A', OFTInteger, 63, 63, 1, 1, 1, 1 },
47 : { "TOIADDL", 'L', 'A', OFTInteger, 64, 64, 1, 1, 1, 1 },
48 : { "FRIADDR", 'L', 'A', OFTInteger, 65, 65, 1, 1, 1, 1 },
49 : { "TOIADDR", 'L', 'A', OFTInteger, 66, 66, 1, 1, 1, 1 },
50 : { "ZIPL", 'L', 'N', OFTInteger, 67, 71, 5, 1, 1, 1 },
51 : { "ZIPR", 'L', 'N', OFTInteger, 72, 76, 5, 1, 1, 1 }
52 : };
53 : static const TigerRecordInfo rt6_info =
54 : {
55 : rt6_fields,
56 : sizeof(rt6_fields) / sizeof(TigerFieldInfo),
57 : 76
58 : };
59 :
60 : /************************************************************************/
61 : /* TigerZipCodes() */
62 : /************************************************************************/
63 :
64 7 : TigerZipCodes::TigerZipCodes( OGRTigerDataSource * poDSIn,
65 7 : const char * pszPrototypeModule ) : TigerFileBase(&rt6_info, FILE_CODE)
66 :
67 : {
68 7 : poDS = poDSIn;
69 7 : poFeatureDefn = new OGRFeatureDefn( "ZipCodes" );
70 7 : poFeatureDefn->Reference();
71 7 : poFeatureDefn->SetGeomType( wkbNone );
72 :
73 : /* -------------------------------------------------------------------- */
74 : /* Fields from type 6 record. */
75 : /* -------------------------------------------------------------------- */
76 :
77 7 : AddFieldDefns( psRTInfo, poFeatureDefn );
78 7 : }
|