Module: ADIWG::Mdtranslator::Readers::Fgdc::MapGridUps

Defined in:
lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_ups.rb

Class Method Summary collapse

Class Method Details

.unpack(xUPS, hProjection, hResponseObj) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_ups.rb', line 17

def self.unpack(xUPS, hProjection, hResponseObj)

   # grid system 4.1.2.2.3 (ups) - universal polar stereographic

   hGridSystemId = hProjection[:gridIdentifier]
   hProjectionId = hProjection[:projectionIdentifier]

   hGridSystemId[:identifier] = 'ups'
   hGridSystemId[:name] = 'Universal Polar Stereographic' if hGridSystemId[:name].nil?

   # grid system 4.1.2.2.3.1 (upszone) - utm zone number {-60..-1, 1..60} (required)
   # -> ReferenceSystemParameters.projection.gridZone
   zone = xUPS.xpath('./upszone').text
   unless zone.empty?
      hProjection[:gridZone] = zone
   end
   if zone.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UPS zone number is missing'
   end

   # + polar stereographic (required)
   xPolarS = xUPS.xpath('./polarst')
   unless xPolarS.empty?
      hProjectionId[:identifier] = 'polarStereo'
      hProjectionId[:name] = 'Polar Stereographic'
      return PolarStereoProjection.unpack(xPolarS, hProjection, hResponseObj)
   end

   # error message
   hResponseObj[:readerExecutionMessages] <<
      'WARNING: FGDC reader: UPS polar stereographic definition is missing'

   return hProjection

end