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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb', line 20
def self.unpack(hProjection, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hProjection.empty?
@MessagePath.issueWarning(650, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intProjection = intMetadataClass.newProjection
outContext = 'projection parameters'
outContext = inContext + ' ' + outContext unless inContext.nil?
if hProjection.has_key?('projectionIdentifier')
unless hProjection['projectionIdentifier'].empty?
hProjectionId = hProjection['projectionIdentifier']
hReturn = Identifier.unpack(hProjectionId, responseObj, outContext)
unless hReturn.nil?
if hProjectionId.has_key?('name')
unless hProjectionId['name'] == ''
hReturn[:name] = hProjectionId['name']
end
end
intProjection[:projectionIdentifier] = hReturn
end
end
end
if intProjection[:projectionIdentifier].empty?
@MessagePath.issueError(651, responseObj, inContext)
end
if hProjection.has_key?('gridIdentifier')
unless hProjection['gridIdentifier'].empty?
hGridSystemId = hProjection['gridIdentifier']
hReturn = Identifier.unpack(hProjection['gridIdentifier'], responseObj, outContext)
unless hReturn.nil?
if hGridSystemId.has_key?('name')
unless hGridSystemId['name'] == ''
hReturn[:name] = hGridSystemId['name']
end
end
intProjection[:gridIdentifier] = hReturn
end
end
end
if hProjection.has_key?('gridZone')
unless hProjection['gridZone'] == ''
intProjection[:gridZone] = hProjection['gridZone']
end
end
if hProjection.has_key?('standardParallel1')
unless hProjection['standardParallel1'] == ''
intProjection[:standardParallel1] = hProjection['standardParallel1']
end
end
if hProjection.has_key?('standardParallel2')
unless hProjection['standardParallel2'] == ''
intProjection[:standardParallel2] = hProjection['standardParallel2']
end
end
if hProjection.has_key?('longitudeOfCentralMeridian')
unless hProjection['longitudeOfCentralMeridian'] == ''
intProjection[:longitudeOfCentralMeridian] = hProjection['longitudeOfCentralMeridian']
end
end
if hProjection.has_key?('latitudeOfProjectionOrigin')
unless hProjection['latitudeOfProjectionOrigin'] == ''
intProjection[:latitudeOfProjectionOrigin] = hProjection['latitudeOfProjectionOrigin']
end
end
if hProjection.has_key?('falseEasting')
unless hProjection['falseEasting'] == ''
intProjection[:falseEasting] = hProjection['falseEasting']
end
end
if hProjection.has_key?('falseNorthing')
unless hProjection['falseNorthing'] == ''
intProjection[:falseNorthing] = hProjection['falseNorthing']
end
end
if hProjection.has_key?('falseEastingNorthingUnits')
unless hProjection['falseEastingNorthingUnits'] == ''
intProjection[:falseEastingNorthingUnits] = hProjection['falseEastingNorthingUnits']
end
end
if hProjection.has_key?('scaleFactorAtEquator')
unless hProjection['scaleFactorAtEquator'] == ''
intProjection[:scaleFactorAtEquator] = hProjection['scaleFactorAtEquator']
end
end
if hProjection.has_key?('heightOfProspectivePointAboveSurface')
unless hProjection['heightOfProspectivePointAboveSurface'] == ''
intProjection[:heightOfProspectivePointAboveSurface] =
hProjection['heightOfProspectivePointAboveSurface']
end
end
if hProjection.has_key?('longitudeOfProjectionCenter')
unless hProjection['longitudeOfProjectionCenter'] == ''
intProjection[:longitudeOfProjectionCenter] = hProjection['longitudeOfProjectionCenter']
end
end
if hProjection.has_key?('latitudeOfProjectionCenter')
unless hProjection['latitudeOfProjectionCenter'] == ''
intProjection[:latitudeOfProjectionCenter] = hProjection['latitudeOfProjectionCenter']
end
end
if hProjection.has_key?('scaleFactorAtCenterLine')
unless hProjection['scaleFactorAtCenterLine'] == ''
intProjection[:scaleFactorAtCenterLine] = hProjection['scaleFactorAtCenterLine']
end
end
if hProjection.has_key?('scaleFactorAtCentralMeridian')
unless hProjection['scaleFactorAtCentralMeridian'] == ''
intProjection[:scaleFactorAtCentralMeridian] = hProjection['scaleFactorAtCentralMeridian']
end
end
if hProjection.has_key?('straightVerticalLongitudeFromPole')
unless hProjection['straightVerticalLongitudeFromPole'] == ''
intProjection[:straightVerticalLongitudeFromPole] = hProjection['straightVerticalLongitudeFromPole']
end
end
if hProjection.has_key?('scaleFactorAtProjectionOrigin')
unless hProjection['scaleFactorAtProjectionOrigin'] == ''
intProjection[:scaleFactorAtProjectionOrigin] = hProjection['scaleFactorAtProjectionOrigin']
end
end
if hProjection.has_key?('azimuthAngle')
unless hProjection['azimuthAngle'] == ''
intProjection[:azimuthAngle] = hProjection['azimuthAngle']
end
end
if hProjection.has_key?('azimuthMeasurePointLongitude')
unless hProjection['azimuthMeasurePointLongitude'] == ''
intProjection[:azimuthMeasurePointLongitude] = hProjection['azimuthMeasurePointLongitude']
end
end
if hProjection.has_key?('obliqueLinePoint')
aItems = hProjection['obliqueLinePoint']
aItems.each do |item|
hReturn = ObliqueLinePoint.unpack(item, responseObj, outContext)
unless hReturn.nil?
intProjection[:obliqueLinePoints] << hReturn
end
end
end
if hProjection.has_key?('landsatNumber')
unless hProjection['landsatNumber'] == ''
intProjection[:landsatNumber] = hProjection['landsatNumber']
end
end
if hProjection.has_key?('landsatPath')
unless hProjection['landsatPath'] == ''
intProjection[:landsatPath] = hProjection['landsatPath']
end
end
if hProjection.has_key?('local')
unless hProjection['local'].empty?
hReturn = LocalProjection.unpack(hProjection['local'], responseObj, outContext)
unless hReturn.nil?
intProjection[:local] = hReturn
end
end
end
return intProjection
end
|