Module: ADIWG::Mdtranslator::Readers::Fgdc::ProjectionCommon

Defined in:
lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb

Class Method Summary collapse

Class Method Details

.unpackFalseNE(xParams, hProjection) ⇒ Object

false northing and easting(xParams, hProjection, hResponseObj)



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 62

def self.unpackFalseNE(xParams, hProjection)
   paramCount = 0
   falseE = xParams.xpath('./feast').text
   unless falseE.empty?
      hProjection[:falseEasting] = falseE.to_f
      paramCount += 1
   end
   falseN = xParams.xpath('./fnorth').text
   unless falseN.empty?
      hProjection[:falseNorthing] = falseN.to_f
      paramCount += 1
   end
   return paramCount
end

.unpackHeightAS(xParams, hProjection) ⇒ Object

height of perspective point above surface



78
79
80
81
82
83
84
85
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 78

def self.unpackHeightAS(xParams, hProjection)
   heightAS = xParams.xpath('./heightpt').text
   unless heightAS.empty?
      hProjection[:heightOfProspectivePointAboveSurface] = heightAS.to_f
      return 1
   end
   return 0
end

.unpackLandSat(xParams, hProjection) ⇒ Object

landsat number



218
219
220
221
222
223
224
225
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 218

def self.unpackLandSat(xParams, hProjection)
   landsatN = xParams.xpath('./landsat').text
   unless landsatN.empty?
      hProjection[:landsatNumber] = landsatN.to_i
      return 1
   end
   return 0
end

.unpackLandSatPath(xParams, hProjection) ⇒ Object

landsat path number



228
229
230
231
232
233
234
235
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 228

def self.unpackLandSatPath(xParams, hProjection)
   landsatP = xParams.xpath('./pathnum').text
   unless landsatP.empty?
      hProjection[:landsatPath] = landsatP.to_i
      return 1
   end
   return 0
end

.unpackLatPC(xParams, hProjection) ⇒ Object

latitude of projection center



98
99
100
101
102
103
104
105
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 98

def self.unpackLatPC(xParams, hProjection)
   latPC = xParams.xpath('./latprjc').text
   unless latPC.empty?
      hProjection[:latitudeOfProjectionCenter] = latPC.to_f
      return 1
   end
   return 0
end

.unpackLatPO(xParams, hProjection) ⇒ Object

latitude of projection origin



52
53
54
55
56
57
58
59
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 52

def self.unpackLatPO(xParams, hProjection)
   latPO = xParams.xpath('./latprjo').text
   unless latPO.empty?
      hProjection[:latitudeOfProjectionOrigin] = latPO.to_f
      return 1
   end
   return 0
end

.unpackLongCM(xParams, hProjection) ⇒ Object

longitude of central meridian



42
43
44
45
46
47
48
49
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 42

def self.unpackLongCM(xParams, hProjection)
   longCM = xParams.xpath('./longcm').text
   unless longCM.empty?
      hProjection[:longitudeOfCentralMeridian] = longCM.to_f
      return 1
   end
   return 0
end

.unpackLongPC(xParams, hProjection) ⇒ Object

longitude of projection center



88
89
90
91
92
93
94
95
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 88

def self.unpackLongPC(xParams, hProjection)
   longPC = xParams.xpath('./longpc').text
   unless longPC.empty?
      hProjection[:longitudeOfProjectionCenter] = longPC.to_f
      return 1
   end
   return 0
end

.unpackObliqueLA(xParams, hProjection) ⇒ Object

oblique line azimuth



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 148

def self.unpackObliqueLA(xParams, hProjection)
   xObliqueLA = xParams.xpath('./obqlazim')
   unless xObliqueLA.empty?
      paramCount = 0
      lineAzimuth = xObliqueLA.xpath('./azimangl').text
      unless lineAzimuth.empty?
         hProjection[:azimuthAngle] = lineAzimuth.to_f
         paramCount += 1
      end
      lineLong = xObliqueLA.xpath('./azimptl').text
      unless lineLong.empty?
         hProjection[:azimuthMeasurePointLongitude] = lineLong.to_f
         paramCount += 1
      end
      return paramCount
   end
   return 0
end

.unpackObliqueLP(xParams, hProjection) ⇒ Object

oblique line point



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
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 168

def self.unpackObliqueLP(xParams, hProjection)
   xObliqueLP = xParams.xpath('./obqlpt')
   unless xObliqueLP.empty?
      paramCount = 0
      hPoint1 = @intMetadataClass.newObliqueLinePoint
      hPoint2 = @intMetadataClass.newObliqueLinePoint

      lat1 = xObliqueLP.xpath('./obqllat[1]').text
      unless lat1.empty?
         hPoint1[:obliqueLineLatitude] = lat1.to_f
         paramCount += 1
      end
      long1 = xObliqueLP.xpath('./obqllong[1]').text
      unless long1.empty?
         hPoint1[:obliqueLineLongitude] = long1.to_f
         paramCount += 1
      end

      lat2 = xObliqueLP.xpath('./obqllat[2]').text
      unless lat2.empty?
         hPoint2[:obliqueLineLatitude] = lat2.to_f
         paramCount += 1
      end
      long2 = xObliqueLP.xpath('./obqllong[2]').text
      unless long2.empty?
         hPoint2[:obliqueLineLongitude] = long2.to_f
         paramCount += 1
      end

      if paramCount == 4
         hProjection[:obliqueLinePoints] << hPoint1
         hProjection[:obliqueLinePoints] << hPoint2
         return hProjection[:obliqueLinePoints].length
      end

   end
   return 0
end

.unpackOtherProjection(xParams, hProjection) ⇒ Object

other projection



238
239
240
241
242
243
244
245
246
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 238

def self.unpackOtherProjection(xParams, hProjection)
   other = xParams.xpath('./otherprj').text
   unless other.empty?
      hProjection[:projectionIdentifier][:identifier] = 'other'
      hProjection[:projectionIdentifier][:description] = other
      return 1
   end
   return 0
end

.unpackSFCenter(xParams, hProjection) ⇒ Object

scale factor at center line



118
119
120
121
122
123
124
125
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 118

def self.unpackSFCenter(xParams, hProjection)
   sFCenter = xParams.xpath('./sfctrlin').text
   unless sFCenter.empty?
      hProjection[:scaleFactorAtCenterLine] = sFCenter.to_f
      return 1
   end
   return 0
end

.unpackSFCM(xParams, hProjection) ⇒ Object

scale factor at central meridian



128
129
130
131
132
133
134
135
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 128

def self.unpackSFCM(xParams, hProjection)
   sFCM = xParams.xpath('./sfctrmer').text
   unless sFCM.empty?
      hProjection[:scaleFactorAtCentralMeridian] = sFCM.to_f
      return 1
   end
   return 0
end

.unpackSFEquator(xParams, hProjection) ⇒ Object

scale factor at equator



108
109
110
111
112
113
114
115
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 108

def self.unpackSFEquator(xParams, hProjection)
   sFEquator = xParams.xpath('./sfequat').text
   unless sFEquator.empty?
      hProjection[:scaleFactorAtEquator] = sFEquator.to_f
      return 1
   end
   return 0
end

.unpackSFPO(xParams, hProjection) ⇒ Object

scale factor at projection origin



138
139
140
141
142
143
144
145
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 138

def self.unpackSFPO(xParams, hProjection)
   sFProjectO = xParams.xpath('./sfprjorg').text
   unless sFProjectO.empty?
      hProjection[:scaleFactorAtProjectionOrigin] = sFProjectO.to_f
      return 1
   end
   return 0
end

.unpackStandParallel(xParams, hProjection) ⇒ Object

standard parallels



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 21

def self.unpackStandParallel(xParams, hProjection)
   paramCount = 0
   aStandP = xParams.xpath('./stdparll')
   unless aStandP.empty?
      aStandP.each_with_index do |xStandP, index|
         standP = xStandP.text
         unless standP.empty?
            if index == 0
               hProjection[:standardParallel1] = standP.to_f
               paramCount += 1
            else
               hProjection[:standardParallel2] = standP.to_f
               paramCount += 1
            end
         end
      end
   end
   return paramCount
end

.unpackVSLong(xParams, hProjection) ⇒ Object

straight vertical longitude from pole



208
209
210
211
212
213
214
215
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb', line 208

def self.unpackVSLong(xParams, hProjection)
   sVLongP = xParams.xpath('./svlong').text
   unless sVLongP.empty?
      hProjection[:straightVerticalLongitudeFromPole] = sVLongP.to_f
      return 1
   end
   return 0
end