17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_planarCoordinateInfo.rb', line 17
def self.unpack(xPlanarCI, hResourceInfo, hResponseObj)
intMetadataClass = InternalMetadata.new
encoding = xPlanarCI.xpath('./plance').text
unless encoding.empty?
hResourceInfo[:spatialRepresentationTypes] << encoding
end
if encoding.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: planar coordinate encoding method is missing'
end
haveRep = false
xCoordRep = xPlanarCI.xpath('./coordrep')
unless xCoordRep.empty?
haveRep = true
hCoordResolution = intMetadataClass.newCoordinateResolution
abscissa = xCoordRep.xpath('./absres').text
unless abscissa.empty?
hCoordResolution[:abscissaResolutionX] = abscissa.to_f
end
if abscissa.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: coordinate representation abscissa resolution is missing'
end
ordinate = xCoordRep.xpath('./ordres').text
unless ordinate.empty?
hCoordResolution[:ordinateResolutionY] = ordinate.to_f
end
if ordinate.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: coordinate representation ordinate resolution is missing'
end
distUnits = xPlanarCI.xpath('./plandu').text
unless distUnits.empty?
hCoordResolution[:unitOfMeasure] = distUnits
end
if distUnits.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: planar distance units are missing'
end
hResolution = intMetadataClass.newSpatialResolution
hResolution[:coordinateResolution] = hCoordResolution
hResourceInfo[:spatialResolutions] << hResolution
end
xBDRep = xPlanarCI.xpath('./distbrep')
unless xBDRep.empty?
haveRep = true
hBDResolution = intMetadataClass.newBearingDistanceResolution
distRes = xBDRep.xpath('./distres').text
unless distRes.empty?
hBDResolution[:distanceResolution] = distRes.to_f
end
if distRes.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance distance resolution is missing'
end
distUnits = xPlanarCI.xpath('./plandu').text
unless distUnits.empty?
hBDResolution[:distanceUnitOfMeasure] = distUnits
end
if distUnits.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance distance units is missing'
end
bearingRes = xBDRep.xpath('./bearres').text
unless bearingRes.empty?
hBDResolution[:bearingResolution] = bearingRes.to_f
end
if bearingRes.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance bearing resolution is missing'
end
bearingUnits = xBDRep.xpath('./bearunit').text
unless bearingUnits.empty?
hBDResolution[:bearingUnitsOfMeasure] = bearingUnits
end
if bearingUnits.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance bearing units is missing'
end
bearingDirection = xBDRep.xpath('./bearrefd').text
unless bearingDirection.empty?
hBDResolution[:bearingReferenceDirection] = bearingDirection
end
if bearingDirection.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance bearing direction is missing'
end
bearingMeridian = xBDRep.xpath('./bearrefm').text
unless bearingMeridian.empty?
hBDResolution[:bearingReferenceMeridian] = bearingMeridian
end
if bearingMeridian.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: bearing-distance bearing meridian is missing'
end
hResolution = intMetadataClass.newSpatialResolution
hResolution[:bearingDistanceResolution] = hBDResolution
hResourceInfo[:spatialResolutions] << hResolution
end
unless haveRep
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: planar coordinate representation is missing'
end
return nil
end
|