Module: ADIWG::Mdtranslator::Readers::Fgdc::MapGridSystem

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

Class Method Summary collapse

Class Method Details

.unpack(xMapGrid, hResponseObj) ⇒ Object



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

def self.unpack(xMapGrid, hResponseObj)

   # instance classes needed in script
   intMetadataClass = .new
   hProjection = intMetadataClass.newProjection
   hGridSystemId = intMetadataClass.newIdentifier
   hProjectionId = intMetadataClass.newIdentifier
   hProjection[:gridIdentifier] = hGridSystemId
   hProjection[:projectionIdentifier] = hProjectionId

   # grid system 4.1.2.2.1 (gridsysn) - grid coordinate system name (required)
   # -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
   gridName = xMapGrid.xpath('./gridsysn').text
   unless gridName.empty?
      hGridSystemId[:name] = gridName
   end
   if gridName.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: grid system name is missing'
   end

   # grid system 4.1.2.2.2 (utm) - universal transverse mercator
   xUTM = xMapGrid.xpath('./utm')
   unless xUTM.empty?
      return MapGridUtm.unpack(xUTM, hProjection, hResponseObj)
   end

   # grid system 4.1.2.2.3 (ups) - universal polar stereographic
   xUPS = xMapGrid.xpath('./ups')
   unless xUPS.empty?
      return MapGridUps.unpack(xUPS, hProjection, hResponseObj)
   end

   # grid system 4.1.2.2.4 (spcs) - state plane coordinate system
   xStateP = xMapGrid.xpath('./spcs')
   unless xStateP.empty?
      return MapGridStatePlane.unpack(xStateP, hProjection, hResponseObj)
   end

   # grid system 4.1.2.2.5 (arcsys) - equal arc-second coordinate system
   xArc = xMapGrid.xpath('./arcsys')
   unless xArc.empty?
      return MapGridEqualArcSecond.unpack(xArc, hProjection, hResponseObj)
   end

   # grid system 4.1.2.2.6 (othergrd) - other coordinate system {text}
   # -> ReferenceSystemParameters.projection.gridIdentifier.description
   otherG = xMapGrid.xpath('./othergrd').text
   unless otherG.empty?
      return MapGridOther.unpack(otherG, hProjection)
   end

   # error message
   hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: grid system is missing'

   return hProjection

end