Module: ADIWG::Mdtranslator::Readers::Fgdc::MapGridEqualArcSecond

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

Class Method Summary collapse

Class Method Details

.unpack(xArc, hProjection, hResponseObj) ⇒ Object



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

def self.unpack(xArc, hProjection, hResponseObj)

   # grid system 4.1.2.2.5 (arcsys) - equal arc-second coordinate system

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

   hGridSystemId[:identifier] = 'arcsys'
   hGridSystemId[:name] = 'Equal Arc-Second Coordinate System' if hGridSystemId[:name].nil?

   # grid system 4.1.2.2.5.1 (arcszone) - state plane zone number {1..18} (required)
   # -> ReferenceSystemParameters.projection.gridZone
   zone = xArc.xpath('./arczone').text
   unless zone.empty?
      hProjection[:gridZone] = zone
   end
   if zone.empty?
      hResponseObj[:readerExecutionMessages] <<
         'WARNING: FGDC reader: equal arc-second zone number is missing'
   end

   # + [ equirectangular | azimuthal equidistant ] (required)
   # + equirectangular
   xEquiR = xArc.xpath('./equirect')
   unless xEquiR.empty?
      hProjectionId[:identifier] = 'equirectangular'
      hProjectionId[:name] = 'Equirectangular'
      return EquirectangularProjection.unpack(xEquiR, hProjection, hResponseObj)
   end

   # + azimuthal equidistant
   xAzimuthE = xArc.xpath('./azimequi')
   unless xAzimuthE.empty?
      hProjectionId[:identifier] = 'azimuthalEquidistant'
      hProjectionId[:name] = 'Azimuthal Equidistant'
      return AzimuthEquidistantProjection.unpack(xAzimuthE, hProjection, hResponseObj)
   end

   # error message
   hResponseObj[:readerExecutionMessages] <<
      'WARNING: FGDC reader: UPS equal arc-second projection definition is missing'

   return hProjection

end