adiwg-mdtranslator 2.13.3 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/CHANGELOG.md +11 -4
  4. data/Rakefile +14 -14
  5. data/adiwg-mdtranslator.gemspec +3 -3
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +14 -14
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_equalArcSecond.rb +69 -0
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_other.rb +42 -0
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_statePlane.rb +87 -0
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_ups.rb +58 -0
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_utm.rb +58 -0
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +7 -7
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +6 -6
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +23 -22
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +7 -7
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +6 -6
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +7 -7
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +6 -6
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +7 -7
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +6 -6
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +7 -7
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +5 -5
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +4 -4
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +8 -8
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +6 -6
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +20 -20
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +8 -8
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +6 -6
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +5 -5
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +5 -5
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +6 -6
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +6 -6
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +7 -7
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +5 -5
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +15 -7
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +6 -3
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +8 -6
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +1 -1
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalPlanar.rb → module_localPlanar.rb} +16 -8
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +23 -8
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +21 -144
  42. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +48 -3
  43. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapCoordinateInfo.rb → module_planarCoordinateInfo.rb} +23 -11
  44. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +1 -1
  45. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +5 -2
  46. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +6 -2
  47. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +20 -5
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +41 -8
  49. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_localProjection.rb +57 -0
  50. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +6 -6
  51. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +36 -53
  52. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +1 -1
  53. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +39 -13
  54. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +20 -8
  55. data/lib/adiwg/mdtranslator/version.rb +11 -1
  56. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +8 -7
  57. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +1 -1
  58. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localPlanar.rb +63 -0
  59. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +30 -15
  60. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjectionTags.rb +164 -109
  61. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +60 -61
  62. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +12 -12
  63. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +87 -99
  64. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +16 -41
  65. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +12 -11
  66. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +9 -4
  67. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +2 -3
  68. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +8 -7
  69. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +13 -6
  70. data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +16 -30
  71. data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +8 -0
  72. data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +4 -4
  73. data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +68 -57
  74. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -6
  75. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +9 -0
  76. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +13 -12
  77. data/lib/adiwg/mdtranslator/writers/html/sections/html_usage.rb +3 -3
  78. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +9 -15
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +12 -15
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +9 -8
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +6 -6
  82. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +2 -1
  83. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +21 -10
  84. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +4 -0
  85. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +2 -3
  86. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_identifier.rb +4 -2
  87. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_localProjection.rb +31 -0
  88. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_obliqueLinePoint.rb +2 -2
  89. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -9
  90. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomy.rb +6 -5
  91. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +2 -2
  92. data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +10 -0
  93. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +21 -0
  94. metadata +17 -10
  95. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +0 -42
@@ -0,0 +1,63 @@
1
+ # FGDC <<Class>> PlanarReference
2
+ # FGDC CSDGM writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2018-10-09 refactor mdJson projection object
6
+ # Stan Smith 2018-03-21 original script
7
+
8
+ require_relative '../fgdc_writer'
9
+ require_relative 'class_mapProjectionTags'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Fgdc
15
+
16
+ class PlanarLocal
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
22
+ end
23
+
24
+ def writeXML(hProjection, inContext = nil)
25
+
26
+ # localPLANAR is not the same as localSYSTEM in fgdc
27
+ # however they use the same 'local' object
28
+ # local system sets projectionIdentifier.identifier = 'localSystem'
29
+ # local planar sets projectionIdentifier.identifier = 'localPlanar'
30
+
31
+ # classes used
32
+ classTags = MapProjectionTags.new(@xml, @hResponseObj)
33
+
34
+ outContext = 'local planar'
35
+ outContext = inContext + ' ' + outContext unless inContext.nil?
36
+
37
+ hProjectionId = hProjection[:projectionIdentifier]
38
+ hLocal = hProjection[:local]
39
+
40
+ if hLocal.empty?
41
+ @NameSpace.issueError(470, outContext)
42
+ return
43
+ end
44
+
45
+ # planar 4.1.2.3 (localp) - local planar
46
+ if hProjectionId[:identifier] == 'localPlanar'
47
+ hProjectionId[:name] = nil unless hProjectionId.has_key?(:name)
48
+ if hProjectionId[:name].nil?
49
+ hProjectionId[:name] = 'Local Planar Coordinate System Fixed to Earth'
50
+ end
51
+ @xml.tag!('localp') do
52
+ classTags.write_localDesc(hProjection, outContext)
53
+ classTags.write_localGeoInfo(hProjection, outContext)
54
+ end
55
+ end
56
+
57
+ end # writeXML
58
+ end # PlanarReference
59
+
60
+ end
61
+ end
62
+ end
63
+ end
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-09 refactor mdJson projection object
5
6
  # Stan Smith 2018-03-20 refactored error and warning messaging
6
7
  # Stan Smith 2018-01-15 original script
7
8
 
@@ -14,37 +15,51 @@ module ADIWG
14
15
 
15
16
  class LocalSystem
16
17
 
17
- def initialize(xml, hResponseObj)
18
+ def initialize(xml, hResponseObj, inContext = nil)
18
19
  @xml = xml
19
20
  @hResponseObj = hResponseObj
20
21
  @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
22
  end
22
23
 
23
- def writeXML(hProjection)
24
+ def writeXML(hProjection, inContext = nil)
24
25
 
25
26
  # localSYSTEM is not the same as localPLANAR in fgdc
26
- # however the same projection parameters are used in mdJson to save info
27
- # local system sets projection = 'localSystem'
28
- # local planar sets projection = 'localPlanar'
27
+ # however they use the same 'local' object
28
+ # local system sets projectionIdentifier.identifier = 'localSystem'
29
+ # local planar sets projectionIdentifier.identifier = 'localPlanar'
29
30
 
30
- if hProjection[:projectionName].nil?
31
- hProjection[:projectionName] = 'local coordinate system not aligned with surface of earth'
31
+ hProjectionId = hProjection[:projectionIdentifier]
32
+ hLocal = hProjection[:local]
33
+
34
+ outContext = 'local system'
35
+ outContext = inContext + ' ' + outContext unless inContext.nil?
36
+
37
+ if hLocal.empty?
38
+ @NameSpace.issueError(250, outContext)
39
+ return
40
+ end
41
+
42
+ if hProjectionId[:identifier] == 'localSystem'
43
+ hProjectionId[:name] = nil unless hProjectionId.has_key?(:name)
44
+ if hProjectionId[:name].nil?
45
+ hProjectionId[:name] = 'Local Coordinate System'
46
+ end
32
47
  end
33
48
 
34
49
  # local system 4.1.3.1 (localdes) - local coordinate system description (required)
35
- unless hProjection[:localPlanarDescription].nil?
36
- @xml.tag!('localdes', hProjection[:localPlanarDescription])
50
+ unless hLocal[:description].nil?
51
+ @xml.tag!('localdes', hLocal[:description])
37
52
  end
38
- if hProjection[:localPlanarDescription].nil?
39
- @NameSpace.issueError(250, hProjection[:projectionName])
53
+ if hLocal[:description].nil?
54
+ @NameSpace.issueError(251, outContext)
40
55
  end
41
56
 
42
57
  # local system 4.1.3.2 (localgeo) - local coordinate system georeference information (required)
43
- unless hProjection[:localPlanarGeoreference].nil?
44
- @xml.tag!('localgeo', hProjection[:localPlanarGeoreference])
58
+ unless hLocal[:georeference].nil?
59
+ @xml.tag!('localgeo', hLocal[:georeference])
45
60
  end
46
- if hProjection[:localPlanarGeoreference].nil?
47
- @NameSpace.issueError(251, hProjection[:projectionName])
61
+ if hLocal[:georeference].nil?
62
+ @NameSpace.issueError(252, outContext)
48
63
  end
49
64
 
50
65
  end # writeXML
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-09 refactor mdJson projection object
5
6
  # Stan Smith 2018-03-20 refactored error and warning messaging
6
7
  # Stan Smith 2018-01-02 original script
7
8
 
@@ -20,20 +21,36 @@ module ADIWG
20
21
  @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
22
  end
22
23
 
24
+ def outContext(inContext, hIdentifier = {})
25
+ outContext = hIdentifier.empty? ? nil : hIdentifier[:projectionIdentifier][:identifier]
26
+ return nil if inContext.nil? && outContext.nil?
27
+ return inContext if outContext.nil?
28
+ return outContext if inContext.nil?
29
+ return inContext + ' ' + outContext
30
+ end
31
+
32
+ def outContextGrid(inContext, hIdentifier = {})
33
+ outContext = hIdentifier.empty? ? nil : hIdentifier[:gridIdentifier][:identifier]
34
+ return nil if inContext.nil? && outContext.nil?
35
+ return inContext if outContext.nil?
36
+ return outContext if inContext.nil?
37
+ return inContext + ' ' + outContext
38
+ end
39
+
23
40
  # map projection 4.1.2.1.1 (mapprojn) - projection name (required)
24
- def write_name(projectionName)
41
+ def write_name(projectionName, inContext = nil)
25
42
  unless projectionName.nil?
26
43
  @xml.tag!('mapprojn', projectionName)
27
44
  end
28
45
  if projectionName.nil?
29
- @NameSpace.issueWarning(280, 'mapprojn')
46
+ @NameSpace.issueWarning(280, 'mapprojn', inContext)
30
47
  end
31
48
  end
32
49
 
33
50
  # map projection 4.1.2.2.1 (gridsysn) - grid system name
34
- def write_gridName(gridSystem)
51
+ def write_gridName(gridSystem, inContext = nil)
35
52
  unless gridSystem.nil?
36
- @xml.tag!('gridsysn', gridSystem)
53
+ @xml.tag!('gridsysn', gridSystem, inContext)
37
54
  end
38
55
  if gridSystem.nil? && @hResponseObj[:writerShowTag]
39
56
  @xml.tag!('gridsysn')
@@ -42,23 +59,23 @@ module ADIWG
42
59
 
43
60
  # map projection (feast) - false easting (required)
44
61
  # map projection (fnorth) - false northing (required)
45
- def write_falseNE(hProjection)
62
+ def write_falseNE(hProjection, inContext = nil)
46
63
  unless hProjection[:falseEasting].nil?
47
64
  @xml.tag!('feast', hProjection[:falseEasting].to_s)
48
65
  end
49
66
  if hProjection[:falseEasting].nil?
50
- @NameSpace.issueError(281, "#{hProjection[:projectionName]} projection")
67
+ @NameSpace.issueError(281, outContext(inContext, hProjection))
51
68
  end
52
69
  unless hProjection[:falseNorthing].nil?
53
70
  @xml.tag!('fnorth', hProjection[:falseNorthing].to_s)
54
71
  end
55
72
  if hProjection[:falseNorthing].nil?
56
- @NameSpace.issueError(282, "#{hProjection[:projectionName]} projection")
73
+ @NameSpace.issueError(282, outContext(inContext, hProjection))
57
74
  end
58
75
  end
59
76
 
60
77
  # map projection (stdparll) - standard parallel (at least one required)
61
- def write_standParallel(hProjection)
78
+ def write_standParallel(hProjection, inContext = nil)
62
79
  haveParallel = false
63
80
  unless hProjection[:standardParallel1].nil?
64
81
  @xml.tag!('stdparll', hProjection[:standardParallel1].to_s)
@@ -69,276 +86,314 @@ module ADIWG
69
86
  haveParallel = true
70
87
  end
71
88
  unless haveParallel
72
- @NameSpace.issueError(283, "#{hProjection[:projectionName]} projection")
89
+ @NameSpace.issueError(283, outContext(inContext, hProjection))
73
90
  end
74
91
  end
75
92
 
76
93
  # map projection (longcm) - longitude of central meridian (required)
77
- def write_longCM(hProjection)
94
+ def write_longCM(hProjection, inContext = nil)
78
95
  unless hProjection[:longitudeOfCentralMeridian].nil?
79
96
  @xml.tag!('longcm', hProjection[:longitudeOfCentralMeridian].to_s)
80
97
  end
81
98
  if hProjection[:longitudeOfCentralMeridian].nil?
82
- @NameSpace.issueError(284, "#{hProjection[:projectionName]} projection")
99
+ @NameSpace.issueError(284, outContext(inContext, hProjection))
83
100
  end
84
101
  end
85
102
 
86
103
  # map projection (latprjo) - latitude of projection origin (required)
87
- def write_latPO(hProjection)
104
+ def write_latPO(hProjection, inContext = nil)
88
105
  unless hProjection[:latitudeOfProjectionOrigin].nil?
89
106
  @xml.tag!('latprjo', hProjection[:latitudeOfProjectionOrigin].to_s)
90
107
  end
91
108
  if hProjection[:latitudeOfProjectionOrigin].nil?
92
- @NameSpace.issueError(285, "#{hProjection[:projectionName]} projection")
109
+ @NameSpace.issueError(285, outContext(inContext, hProjection))
93
110
  end
94
111
  end
95
112
 
96
113
  # map projection (heightpt) - height of perspective point above surface (required)
97
- def write_heightPP(hProjection)
114
+ def write_heightPP(hProjection, inContext = nil)
98
115
  unless hProjection[:heightOfProspectivePointAboveSurface].nil?
99
116
  @xml.tag!('heightpt', hProjection[:heightOfProspectivePointAboveSurface].to_s)
100
117
  end
101
118
  if hProjection[:heightOfProspectivePointAboveSurface].nil?
102
- @NameSpace.issueError(286, "#{hProjection[:projectionName]} projection")
119
+ @NameSpace.issueError(286, outContext(inContext, hProjection))
103
120
  end
104
121
  end
105
122
 
106
123
  # map projection (longpc) - longitude of projection center (required)
107
- def write_longPC(hProjection)
124
+ def write_longPC(hProjection, inContext = nil)
108
125
  unless hProjection[:longitudeOfProjectionCenter].nil?
109
126
  @xml.tag!('longpc', hProjection[:longitudeOfProjectionCenter].to_s)
110
127
  end
111
128
  if hProjection[:longitudeOfProjectionCenter].nil?
112
- @NameSpace.issueError(287, "#{hProjection[:projectionName]} projection")
129
+ @NameSpace.issueError(287, outContext(inContext, hProjection))
113
130
  end
114
131
  end
115
132
 
116
133
  # map projection (latprjc) - latitude of projection center (required)
117
- def write_latPC(hProjection)
134
+ def write_latPC(hProjection, inContext = nil)
118
135
  unless hProjection[:latitudeOfProjectionCenter].nil?
119
136
  @xml.tag!('latprjc', hProjection[:latitudeOfProjectionCenter].to_s)
120
137
  end
121
138
  if hProjection[:latitudeOfProjectionCenter].nil?
122
- @NameSpace.issueError(288, "#{hProjection[:projectionName]} projection")
139
+ @NameSpace.issueError(288, outContext(inContext, hProjection))
123
140
  end
124
141
  end
125
142
 
126
143
  # map projection (sfequat) - scale factor at equator (required)
127
- def write_scaleFactorE(hProjection)
144
+ def write_scaleFactorE(hProjection, inContext = nil)
128
145
  unless hProjection[:scaleFactorAtEquator].nil?
129
146
  @xml.tag!('sfequat', hProjection[:scaleFactorAtEquator].to_s)
130
147
  end
131
148
  if hProjection[:scaleFactorAtEquator].nil?
132
- @NameSpace.issueError(289, "#{hProjection[:projectionName]} projection")
149
+ @NameSpace.issueError(289, outContext(inContext, hProjection))
133
150
  end
134
151
  end
135
152
 
136
153
  # map projection (sfctrlin) - scale factor at center line (required)
137
- def write_scaleFactorCL(hProjection)
154
+ def write_scaleFactorCL(hProjection, inContext = nil)
138
155
  unless hProjection[:scaleFactorAtCenterLine].nil?
139
156
  @xml.tag!('sfctrlin', hProjection[:scaleFactorAtCenterLine].to_s)
140
157
  end
141
158
  if hProjection[:scaleFactorAtCenterLine].nil?
142
- @NameSpace.issueError(290, "#{hProjection[:projectionName]} projection")
159
+ @NameSpace.issueError(290, outContext(inContext, hProjection))
143
160
  end
144
161
  end
145
162
 
146
163
  # map projection (sfprjorg) - scale factor at projection origin (required)
147
- def write_scaleFactorPO(hProjection)
164
+ def write_scaleFactorPO(hProjection, inContext = nil)
148
165
  unless hProjection[:scaleFactorAtProjectionOrigin].nil?
149
166
  @xml.tag!('sfprjorg', hProjection[:scaleFactorAtProjectionOrigin].to_s)
150
167
  end
151
168
  if hProjection[:scaleFactorAtProjectionOrigin].nil?
152
- @NameSpace.issueError(291, "#{hProjection[:projectionName]} projection")
169
+ @NameSpace.issueError(291, outContext(inContext, hProjection))
153
170
  end
154
171
  end
155
172
 
156
173
  # map projection (sfctrmer) - scale factor at central meridian (required)
157
- def write_scaleFactorCM(hProjection)
174
+ def write_scaleFactorCM(hProjection, inContext = nil)
158
175
  unless hProjection[:scaleFactorAtCentralMeridian].nil?
159
176
  @xml.tag!('sfctrmer', hProjection[:scaleFactorAtCentralMeridian].to_s)
160
177
  end
161
178
  if hProjection[:scaleFactorAtCentralMeridian].nil?
162
- @NameSpace.issueError(292, "#{hProjection[:projectionName]} projection")
179
+ @NameSpace.issueError(292, outContext(inContext, hProjection))
163
180
  end
164
181
  end
165
182
 
166
183
  # map projection (obqlazim) - oblique line azimuth (required)
167
- def write_obliqueLineAzimuth(hProjection)
168
- haveLA = true
169
- haveLA = false if hProjection[:azimuthAngle].nil?
170
- haveLA = false if hProjection[:azimuthMeasurePointLongitude].nil?
184
+ def write_obliqueLineAzimuth(hProjection, inContext = nil)
185
+ haveLA = false
186
+ haveLA = true unless hProjection[:azimuthAngle].nil?
187
+ haveLA = true unless hProjection[:azimuthMeasurePointLongitude].nil?
171
188
  if haveLA
172
189
  @xml.tag!('obqlazim') do
173
190
  unless hProjection[:azimuthAngle].nil?
174
191
  @xml.tag!('azimangl', hProjection[:azimuthAngle].to_s)
175
192
  end
176
193
  if hProjection[:azimuthAngle].nil?
177
- @NameSpace.issueError(293, "#{hProjection[:projectionName]} projection")
194
+ @NameSpace.issueError(293, outContext(inContext, hProjection))
178
195
  end
179
196
  unless hProjection[:azimuthMeasurePointLongitude].nil?
180
197
  @xml.tag!('azimptl', hProjection[:azimuthMeasurePointLongitude].to_s)
181
198
  end
182
199
  if hProjection[:azimuthMeasurePointLongitude].nil?
183
- @NameSpace.issueError(294, "#{hProjection[:projectionName]} projection")
200
+ @NameSpace.issueError(294, outContext(inContext, hProjection))
184
201
  end
185
202
  end
186
203
  end
187
204
  unless haveLA
188
- @NameSpace.issueError(295, "#{hProjection[:projectionName]} projection")
205
+ @NameSpace.issueError(295, outContext(inContext, hProjection))
189
206
  end
190
207
  end
191
208
 
192
209
  # map projection (obqlpt) - oblique line point (required)
193
- def write_obliqueLinePoint(hLinePt)
194
- unless hLinePt[:azimuthLineLatitude].nil?
195
- @xml.tag!('obqllat', hLinePt[:azimuthLineLatitude])
196
- end
197
- if hLinePt[:azimuthLineLatitude].nil?
198
- @NameSpace.issueError(296, 'oblique line-point projection')
199
- end
200
- unless hLinePt[:azimuthLineLongitude].nil?
201
- @xml.tag!('obqllong', hLinePt[:azimuthLineLongitude])
210
+ def write_obliqueLinePoint(hProjection, inContext = nil)
211
+ aLinePoint = hProjection[:obliqueLinePoints]
212
+ @xml.tag!('obqlpt') do
213
+ aLinePoint.each do |hLinePt|
214
+ unless hLinePt[:obliqueLineLatitude].nil?
215
+ @xml.tag!('obqllat', hLinePt[:obliqueLineLatitude])
216
+ end
217
+ if hLinePt[:obliqueLineLatitude].nil?
218
+ @NameSpace.issueError(296, outContext(inContext, hProjection))
219
+ end
220
+ unless hLinePt[:obliqueLineLongitude].nil?
221
+ @xml.tag!('obqllong', hLinePt[:obliqueLineLongitude])
222
+ end
223
+ if hLinePt[:obliqueLineLongitude].nil?
224
+ @NameSpace.issueError(297, outContext(inContext, hProjection))
225
+ end
226
+ end
202
227
  end
203
- if hLinePt[:azimuthLineLongitude].nil?
204
- @NameSpace.issueError(297, 'oblique line-point projection')
228
+ unless aLinePoint.length == 2
229
+ @NameSpace.issueError(302, outContext(inContext, hProjection))
205
230
  end
206
231
  end
207
232
 
208
233
  # map projection (svlong) - straight vertical longitude from pole (required)
209
- def write_straightFromPole(hProjection)
234
+ def write_straightFromPole(hProjection, inContext = nil)
210
235
  unless hProjection[:straightVerticalLongitudeFromPole].nil?
211
236
  @xml.tag!('svlong', hProjection[:straightVerticalLongitudeFromPole].to_s)
212
237
  end
213
238
  if hProjection[:straightVerticalLongitudeFromPole].nil?
214
- @NameSpace.issueError(298, "#{hProjection[:projectionName]} projection")
239
+ @NameSpace.issueError(298, outContext(inContext, hProjection))
215
240
  end
216
241
  end
217
242
 
218
243
  # map projection (landsat) - landsat number (required)
219
- def write_landsat(hProjection)
244
+ def write_landsat(hProjection, inContext = nil)
220
245
  unless hProjection[:landsatNumber].nil?
221
246
  @xml.tag!('landsat', hProjection[:landsatNumber].to_s)
222
247
  end
223
248
  if hProjection[:landsatNumber].nil?
224
- @NameSpace.issueError(299, "#{hProjection[:projectionName]} projection")
249
+ @NameSpace.issueError(299, outContext(inContext, hProjection))
225
250
  end
226
251
  end
227
252
 
228
253
  # map projection (pathnum) - landsat path (required)
229
- def write_landsatPath(hProjection)
254
+ def write_landsatPath(hProjection, inContext = nil)
230
255
  unless hProjection[:landsatPath].nil?
231
256
  @xml.tag!('pathnum', hProjection[:landsatPath].to_s)
232
257
  end
233
258
  if hProjection[:landsatPath].nil?
234
- @NameSpace.issueError(300, "#{hProjection[:projectionName]} projection")
259
+ @NameSpace.issueError(300, outContext(inContext, hProjection))
260
+ end
261
+ end
262
+
263
+ # grid coordinate system (localpd) - local planar description (required)
264
+ def write_localDesc(hProjection, inContext)
265
+ hLocal = hProjection[:local]
266
+ unless hLocal.empty?
267
+ @xml.tag!('localpd', hLocal[:description])
268
+ end
269
+ if hLocal[:description].nil?
270
+ @NameSpace.issueError(471, outContext(inContext))
271
+ end
272
+ end
273
+
274
+ # grid coordinate system (localpgi) - local planar georeference information (required)
275
+ def write_localGeoInfo(hProjection, inContext)
276
+ hLocal = hProjection[:local]
277
+ unless hLocal.empty?
278
+ @xml.tag!('localpgi', hLocal[:georeference])
279
+ end
280
+ if hLocal[:georeference].nil?
281
+ @NameSpace.issueError(472, outContext(inContext))
235
282
  end
236
283
  end
237
284
 
238
285
  # map projection (otherprj) - other projection description (required)
239
- def write_otherProjection(hProjection)
240
- unless hProjection[:otherProjectionDescription].nil?
241
- @xml.tag!('otherprj', hProjection[:otherProjectionDescription])
286
+ def write_otherProjection(hProjection, inContext = nil)
287
+ unless hProjection[:projectionIdentifier][:description].nil?
288
+ @xml.tag!('otherprj', hProjection[:projectionIdentifier][:description])
242
289
  end
243
- if hProjection[:otherProjectionDescription].nil?
244
- @NameSpace.issueError(301, "#{hProjection[:projectionName]} projection")
290
+ if hProjection[:projectionIdentifier][:description].nil?
291
+ @NameSpace.issueError(301, outContext(inContext, hProjection))
245
292
  end
246
293
  end
247
294
 
248
295
  # map projection (mapprojp) - other projection description (required)
249
- def write_allParams(hProjection)
250
- # save current writer error state
251
- writerPass = @hResponseObj[:writerPass]
252
- writerMessages = @hResponseObj[:writerMessages]
296
+ def write_allParams(hProjection, inContext)
253
297
 
254
298
  # write all parameters
255
- write_falseNE(hProjection)
256
- write_standParallel(hProjection)
257
- write_longCM(hProjection)
258
- write_latPO(hProjection)
259
- write_heightPP(hProjection)
260
- write_longPC(hProjection)
261
- write_latPC(hProjection)
262
- write_scaleFactorE(hProjection)
263
- write_scaleFactorCL(hProjection)
264
- write_scaleFactorPO(hProjection)
265
- write_scaleFactorCM(hProjection)
266
- write_obliqueLineAzimuth(hProjection)
299
+ unless hProjection[:falseNorthing].nil?
300
+ write_falseNE(hProjection, inContext)
301
+ end
302
+ unless hProjection[:standardParallel1].nil?
303
+ write_standParallel(hProjection, inContext)
304
+ end
305
+ unless hProjection[:longitudeOfCentralMeridian].nil?
306
+ write_longCM(hProjection, inContext)
307
+ end
308
+ unless hProjection[:latitudeOfProjectionOrigin].nil?
309
+ write_latPO(hProjection, inContext)
310
+ end
311
+ unless hProjection[:heightOfProspectivePointAboveSurface].nil?
312
+ write_heightPP(hProjection, inContext)
313
+ end
314
+ unless hProjection[:longitudeOfProjectionCenter].nil?
315
+ write_longPC(hProjection, inContext)
316
+ end
317
+ unless hProjection[:latitudeOfProjectionCenter].nil?
318
+ write_latPC(hProjection, inContext)
319
+ end
320
+ unless hProjection[:scaleFactorAtEquator].nil?
321
+ write_scaleFactorE(hProjection, inContext)
322
+ end
323
+ unless hProjection[:scaleFactorAtCenterLine].nil?
324
+ write_scaleFactorCL(hProjection, inContext)
325
+ end
326
+ unless hProjection[:scaleFactorAtProjectionOrigin].nil?
327
+ write_scaleFactorPO(hProjection, inContext)
328
+ end
329
+ unless hProjection[:scaleFactorAtCentralMeridian].nil?
330
+ write_scaleFactorCM(hProjection, inContext)
331
+ end
332
+ unless hProjection[:azimuthAngle].nil?
333
+ write_obliqueLineAzimuth(hProjection, inContext)
334
+ end
267
335
  unless hProjection[:obliqueLinePoints].empty?
268
- @xml.tag!('obqlpt') do
269
- hProjection[:obliqueLinePoints].each do |hLinePt|
270
- write_obliqueLinePoint(hLinePt)
271
- end
272
- end
336
+ write_obliqueLinePoint(hProjection, inContext)
337
+ end
338
+ unless hProjection[:straightVerticalLongitudeFromPole].nil?
339
+ write_straightFromPole(hProjection, inContext)
340
+ end
341
+ unless hProjection[:landsatNumber].nil?
342
+ write_landsat(hProjection, inContext)
343
+ end
344
+ unless hProjection[:landsatPath].nil?
345
+ write_landsatPath(hProjection, inContext)
273
346
  end
274
- write_straightFromPole(hProjection)
275
- write_landsat(hProjection)
276
- write_landsatPath(hProjection)
277
- write_otherProjection(hProjection)
278
-
279
- # restore writer error state
280
- @hResponseObj[:writerPass] = writerPass
281
- @hResponseObj[:writerMessages] = writerMessages
282
347
 
283
348
  end
284
349
 
285
350
  # grid coordinate system (utmzone) - universal transverse mercator zone (required)
286
- def write_utmZone(hProjection)
351
+ def write_utmZone(hProjection, inContext)
287
352
  unless hProjection[:gridZone].nil?
288
353
  @xml.tag!('utmzone', hProjection[:gridZone])
289
354
  end
290
355
  if hProjection[:gridZone].nil?
291
- @NameSpace.issueError(310, 'grid system')
356
+ @NameSpace.issueError(310, outContextGrid(inContext, hProjection))
292
357
  end
293
358
  end
294
359
 
295
360
  # grid coordinate system (upszone) - universal polar stereographic zone (required)
296
- def write_upsZone(hProjection)
361
+ def write_upsZone(hProjection, inContext)
297
362
  unless hProjection[:gridZone].nil?
298
363
  @xml.tag!('upszone', hProjection[:gridZone])
299
364
  end
300
365
  if hProjection[:gridZone].nil?
301
- @NameSpace.issueError(311, 'grid system')
366
+ @NameSpace.issueError(311, outContextGrid(inContext, hProjection))
302
367
  end
303
368
  end
304
369
 
305
370
  # grid coordinate system (spcszone) - state plane coordinate system zone (required)
306
- def write_spcsZone(hProjection)
371
+ def write_spcsZone(hProjection, inContext)
307
372
  unless hProjection[:gridZone].nil?
308
373
  @xml.tag!('spcszone', hProjection[:gridZone])
309
374
  end
310
375
  if hProjection[:gridZone].nil?
311
- @NameSpace.issueError(312, 'grid system')
376
+ @NameSpace.issueError(312, outContextGrid(inContext, hProjection))
312
377
  end
313
378
  end
314
379
 
315
380
  # grid coordinate system (arczone) - equal arc-second coordinate system zone (required)
316
- def write_arcZone(hProjection)
381
+ def write_arcZone(hProjection, inContext)
317
382
  unless hProjection[:gridZone].nil?
318
383
  @xml.tag!('arczone', hProjection[:gridZone])
319
384
  end
320
385
  if hProjection[:gridZone].nil?
321
- @NameSpace.issueError(313, 'grid system')
386
+ @NameSpace.issueError(313, outContextGrid(inContext, hProjection))
322
387
  end
323
388
  end
324
389
 
325
- # grid coordinate system (localpd) - local planar description (required)
326
- def write_localDesc(hProjection)
327
- unless hProjection[:localPlanarDescription].nil?
328
- @xml.tag!('localpd', hProjection[:localPlanarDescription])
329
- end
330
- if hProjection[:localPlanarDescription].nil?
331
- @NameSpace.issueError(302, "#{hProjection[:projectionName]}")
332
- end
333
- end
334
-
335
- # grid coordinate system (localpgi) - local planar georeference information (required)
336
- def write_localGeoInfo(hProjection)
337
- unless hProjection[:localPlanarGeoreference].nil?
338
- @xml.tag!('localpgi', hProjection[:localPlanarGeoreference])
390
+ # map projection (othergrd) - other grid description (required)
391
+ def write_otherGrid(hProjection, inContext = nil)
392
+ unless hProjection[:gridIdentifier][:description].nil?
393
+ @xml.tag!('othergrd', hProjection[:gridIdentifier][:description])
339
394
  end
340
- if hProjection[:localPlanarGeoreference].nil?
341
- @NameSpace.issueError(303, "#{hProjection[:projectionName]}")
395
+ if hProjection[:gridIdentifier][:description].nil?
396
+ @NameSpace.issueError(314, outContext(inContext, hProjection))
342
397
  end
343
398
  end
344
399