Line data Source code
1 : /******************************************************************************
2 : *
3 : * Project: TIGER/Line Translator
4 : * Purpose: Implements TigerLandmarks, providing access to .RT7 files.
5 : * Author: Frank Warmerdam, warmerdam@pobox.com
6 : *
7 : ******************************************************************************
8 : * Copyright (c) 1999, Frank Warmerdam
9 : *
10 : * SPDX-License-Identifier: MIT
11 : ****************************************************************************/
12 :
13 : #include "ogr_tiger.h"
14 : #include "cpl_conv.h"
15 :
16 : static const char SEVEN_FILE_CODE[] = "7";
17 :
18 : static const TigerFieldInfo rt7_2002_fields[] = {
19 : // fieldname fmt type OFTType beg end len bDefine bSet
20 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
21 : {"FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1},
22 : {"LAND", 'R', 'N', OFTInteger, 11, 20, 10, 1, 1},
23 : {"SOURCE", 'L', 'A', OFTString, 21, 21, 1, 1, 1},
24 : {"CFCC", 'L', 'A', OFTString, 22, 24, 3, 1, 1},
25 : {"LANAME", 'L', 'A', OFTString, 25, 54, 30, 1, 1},
26 : {"LALONG", 'R', 'N', OFTInteger, 55, 64, 10, 1, 1},
27 : {"LALAT", 'R', 'N', OFTInteger, 65, 73, 9, 1, 1},
28 : {"FILLER", 'L', 'A', OFTString, 74, 74, 1, 1, 1},
29 : };
30 : static const TigerRecordInfo rt7_2002_info = {
31 : rt7_2002_fields, sizeof(rt7_2002_fields) / sizeof(TigerFieldInfo), 74};
32 :
33 : static const TigerFieldInfo rt7_fields[] = {
34 : // fieldname fmt type OFTType beg end len bDefine bSet
35 : {"MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0},
36 : {"FILE", 'L', 'N', OFTString, 6, 10, 5, 1, 0},
37 : {"STATE", 'L', 'N', OFTInteger, 6, 7, 2, 1, 1},
38 : {"COUNTY", 'L', 'N', OFTInteger, 8, 10, 3, 1, 1},
39 : {"LAND", 'R', 'N', OFTInteger, 11, 20, 10, 1, 1},
40 : {"SOURCE", 'L', 'A', OFTString, 21, 21, 1, 1, 1},
41 : {"CFCC", 'L', 'A', OFTString, 22, 24, 3, 1, 1},
42 : {"LANAME", 'L', 'A', OFTString, 25, 54, 30, 1, 1}};
43 : static const TigerRecordInfo rt7_info = {
44 : rt7_fields, sizeof(rt7_fields) / sizeof(TigerFieldInfo), 74};
45 :
46 : /************************************************************************/
47 : /* TigerLandmarks() */
48 : /************************************************************************/
49 :
50 0 : TigerLandmarks::TigerLandmarks(OGRTigerDataSource *poDSIn,
51 0 : CPL_UNUSED const char *pszPrototypeModule)
52 0 : : TigerPoint(nullptr, SEVEN_FILE_CODE)
53 : {
54 0 : poDS = poDSIn;
55 0 : poFeatureDefn = new OGRFeatureDefn("Landmarks");
56 0 : poFeatureDefn->Reference();
57 0 : poFeatureDefn->SetGeomType(wkbPoint);
58 :
59 0 : if (poDS->GetVersion() >= TIGER_2002)
60 : {
61 0 : psRTInfo = &rt7_2002_info;
62 : }
63 : else
64 : {
65 0 : psRTInfo = &rt7_info;
66 : }
67 :
68 0 : AddFieldDefns(psRTInfo, poFeatureDefn);
69 0 : }
70 :
71 0 : OGRFeature *TigerLandmarks::GetFeature(int nRecordId)
72 : {
73 0 : return TigerPoint::GetFeature(nRecordId, 55, 64, 65, 73);
74 : }
|