Module: ADIWG::Mdtranslator::Readers::Fgdc::MapGridStatePlane

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

Class Method Summary collapse

Class Method Details

.unpack(xStateP, hProjection, hResponseObj) ⇒ Object



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

def self.unpack(xStateP, hProjection, hResponseObj)

   # grid system 4.1.2.2.4 (spcs) - state plane coordinate system

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

   hGridSystemId[:identifier] = 'spcs'
   hGridSystemId[:name] = 'State Plane Coordinate System' if hGridSystemId[:name].nil?

   # grid system 4.1.2.2.4.1 (spcszone) - state plane zone number {nnnn} (required)
   # -> ReferenceSystemParameters.projection.gridZone
   zone = xStateP.xpath('./spcszone').text
   unless zone.empty?
      hProjection[:gridZone] = zone
   end
   if zone.empty?
      hResponseObj[:readerExecutionMessages] <<
         'WARNING: FGDC reader: state plane zone number is missing'
   end

   # + [ lambert conformal conic | transverse mercator | oblique mercator | polyconic ] (required)
   # + lambert conformal conic
   xLambert = xStateP.xpath('./lambertc')
   unless xLambert.empty?
      hProjectionId[:identifier] = 'lambertConic'
      hProjectionId[:name] = 'Lambert Conformal Conic'
      return LambertConicProjection.unpack(xLambert, hProjection, hResponseObj)
   end

   # + transverse mercator
   xTransMer = xStateP.xpath('./transmer')
   unless xTransMer.empty?
      hProjectionId[:identifier] = 'transverseMercator'
      hProjectionId[:name] = 'Transverse Mercator'
      return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
   end

   # + oblique mercator
   xObliqueM = xStateP.xpath('./obqmerc')
   unless xObliqueM.empty?
      hProjectionId[:identifier] = 'obliqueMercator'
      hProjectionId[:name] = 'Oblique Mercator'
      return ObliqueMercatorProjection.unpack(xObliqueM, hProjection, hResponseObj)
   end

   # + polyconic
   xPolyCon = xStateP.xpath('./polycon')
   unless xPolyCon.empty?
      hProjectionId[:identifier] = 'polyconic'
      hProjectionId[:name] = 'Polyconic'
      return PolyconicProjection.unpack(xPolyCon, hProjection, hResponseObj)
   end

   # error message
   hResponseObj[:readerExecutionMessages] <<
      'WARNING: FGDC reader: UPS state plane projection definition is missing'

   return hProjection

end