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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb', line 18
def self.unpack(xHorizontalRef, hResponseObj)
intMetadataClass = InternalMetadata.new
hGeodetic = intMetadataClass.newGeodetic
xGeodetic = xHorizontalRef.xpath('./geodetic')
datumName = xGeodetic.xpath('./horizdn').text
unless datumName.empty?
hGeodetic[:datumIdentifier] = intMetadataClass.newIdentifier
hGeodetic[:datumIdentifier][:identifier] = datumName
hGeodetic[:datumIdentifier][:name] = datumName
end
ellipsoidName = xGeodetic.xpath('./ellips').text
unless ellipsoidName.empty?
hGeodetic[:ellipsoidIdentifier] = intMetadataClass.newIdentifier
hGeodetic[:ellipsoidIdentifier][:identifier] = ellipsoidName
hGeodetic[:ellipsoidIdentifier][:name] = ellipsoidName
end
if ellipsoidName.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: geodetic reference ellipsoid name is missing'
end
semiAxis = xGeodetic.xpath('./semiaxis').text
unless semiAxis.empty?
hGeodetic[:semiMajorAxis] = semiAxis.to_f
end
if semiAxis.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: geodetic reference radius of semi-major axis is missing'
end
axPlanar = xHorizontalRef.xpath('./planar')
unless axPlanar.empty?
axPlanar.each do |xPlanar|
xPlanCI = xPlanar.xpath('./planci')
unless xPlanCI.empty?
units = xPlanCI.xpath('./plandu').text
unless units.empty?
hGeodetic[:axisUnits] = units
end
end
end
end
flattening = xGeodetic.xpath('./denflat').text
unless flattening.empty?
hGeodetic[:denominatorOfFlatteningRatio] = flattening.to_f
end
if flattening.empty?
hResponseObj[:readerExecutionMessages] <<
'WARNING: FGDC reader: geodetic reference denominator flattening ratio is missing'
end
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
hSystemParameters[:geodetic] = hGeodetic
hReferenceSystem[:systemParameterSet] = hSystemParameters
return hReferenceSystem
end
|