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
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-10 refactor mdJson projection object
5
6
  # Stan Smith 2018-03-21 original script
6
7
 
7
8
  require_relative 'class_mapProjectionTags'
@@ -18,271 +19,258 @@ module ADIWG
18
19
  @hResponseObj = hResponseObj
19
20
  end
20
21
 
21
- def writeXML(hProjection)
22
+ def writeXML(hProjection, inContext = nil)
22
23
 
23
24
  # classes used
24
25
  classTags = MapProjectionTags.new(@xml, @hResponseObj)
25
26
 
27
+ outContext = 'map projection'
28
+ outContext = inContext + ' ' + outContext unless inContext.nil?
29
+
26
30
  # planar 4.1.2.1 (mapproj) - map projection
27
31
  # <- hProjection.projectionName = oneOf ...
28
- projection = hProjection[:projection]
32
+ projection = hProjection[:projectionIdentifier][:identifier]
33
+ projectionName = nil
34
+ if hProjection.key?(:name)
35
+ projectionName = hProjection[:name]
36
+ end
29
37
  case projection
30
38
  when 'alaska'
31
39
  @xml.tag!('mapproj') do
32
- projectionName = 'Modified Stereographic for Alaska'
33
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
40
+ projectionName = 'Alaska Modified Stereographic' if projectionName.nil?
34
41
  classTags.write_name(projectionName)
35
42
  @xml.tag!('modsak') do
36
- classTags.write_falseNE(hProjection)
43
+ classTags.write_falseNE(hProjection, outContext)
37
44
  end
38
45
  end
39
46
  when 'albers'
40
47
  @xml.tag!('mapproj') do
41
48
  projectionName = 'Albers Conical Equal Area'
42
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
43
49
  classTags.write_name(projectionName)
44
50
  @xml.tag!('albers') do
45
- classTags.write_standParallel(hProjection)
46
- classTags.write_longCM(hProjection)
47
- classTags.write_latPO(hProjection)
48
- classTags.write_falseNE(hProjection)
51
+ classTags.write_standParallel(hProjection, outContext)
52
+ classTags.write_longCM(hProjection, outContext)
53
+ classTags.write_latPO(hProjection, outContext)
54
+ classTags.write_falseNE(hProjection, outContext)
49
55
  end
50
56
  end
51
57
  when 'azimuthalEquidistant'
52
58
  @xml.tag!('mapproj') do
53
59
  projectionName = 'Azimuthal Equidistant'
54
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
55
60
  classTags.write_name(projectionName)
56
61
  @xml.tag!('azimequi') do
57
- classTags.write_longCM(hProjection)
58
- classTags.write_latPO(hProjection)
59
- classTags.write_falseNE(hProjection)
62
+ classTags.write_longCM(hProjection, outContext)
63
+ classTags.write_latPO(hProjection, outContext)
64
+ classTags.write_falseNE(hProjection, outContext)
60
65
  end
61
66
  end
62
67
  when 'equidistantConic'
63
68
  @xml.tag!('mapproj') do
64
69
  projectionName = 'Equidistant Conic'
65
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
66
70
  classTags.write_name(projectionName)
67
71
  @xml.tag!('equicon') do
68
- classTags.write_standParallel(hProjection)
69
- classTags.write_longCM(hProjection)
70
- classTags.write_latPO(hProjection)
71
- classTags.write_falseNE(hProjection)
72
+ classTags.write_standParallel(hProjection, outContext)
73
+ classTags.write_longCM(hProjection, outContext)
74
+ classTags.write_latPO(hProjection, outContext)
75
+ classTags.write_falseNE(hProjection, outContext)
72
76
  end
73
77
  end
74
78
  when 'equirectangular'
75
79
  @xml.tag!('mapproj') do
76
80
  projectionName = 'Equirectangular'
77
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
78
81
  classTags.write_name(projectionName)
79
82
  @xml.tag!('equirect') do
80
- classTags.write_standParallel(hProjection)
81
- classTags.write_longCM(hProjection)
82
- classTags.write_falseNE(hProjection)
83
+ classTags.write_standParallel(hProjection, outContext)
84
+ classTags.write_longCM(hProjection, outContext)
85
+ classTags.write_falseNE(hProjection, outContext)
83
86
  end
84
87
  end
85
88
  when 'generalVertical'
86
89
  @xml.tag!('mapproj') do
87
90
  projectionName = 'General Vertical Near-sided Perspective'
88
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
89
91
  classTags.write_name(projectionName)
90
92
  @xml.tag!('gvnsp') do
91
- classTags.write_heightPP(hProjection)
92
- classTags.write_longPC(hProjection)
93
- classTags.write_latPC(hProjection)
94
- classTags.write_falseNE(hProjection)
93
+ classTags.write_heightPP(hProjection, outContext)
94
+ classTags.write_longPC(hProjection, outContext)
95
+ classTags.write_latPC(hProjection, outContext)
96
+ classTags.write_falseNE(hProjection, outContext)
95
97
  end
96
98
  end
97
99
  when 'gnomonic'
98
100
  @xml.tag!('mapproj') do
99
101
  projectionName = 'Gnomonic'
100
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
101
102
  classTags.write_name(projectionName)
102
103
  @xml.tag!('gnomonic') do
103
- classTags.write_longPC(hProjection)
104
- classTags.write_latPC(hProjection)
105
- classTags.write_falseNE(hProjection)
104
+ classTags.write_longPC(hProjection, outContext)
105
+ classTags.write_latPC(hProjection, outContext)
106
+ classTags.write_falseNE(hProjection, outContext)
106
107
  end
107
108
  end
108
109
  when 'lambertEqualArea'
109
110
  @xml.tag!('mapproj') do
110
111
  projectionName = 'Lambert Azimuthal Equal Area'
111
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
112
112
  classTags.write_name(projectionName)
113
113
  @xml.tag!('lamberta') do
114
- classTags.write_longPC(hProjection)
115
- classTags.write_latPC(hProjection)
116
- classTags.write_falseNE(hProjection)
114
+ classTags.write_longPC(hProjection, outContext)
115
+ classTags.write_latPC(hProjection, outContext)
116
+ classTags.write_falseNE(hProjection, outContext)
117
117
  end
118
118
  end
119
119
  when 'lambertConic'
120
120
  @xml.tag!('mapproj') do
121
121
  projectionName = 'Lambert Conformal Conic'
122
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
123
122
  classTags.write_name(projectionName)
124
123
  @xml.tag!('lambertc') do
125
- classTags.write_standParallel(hProjection)
126
- classTags.write_longCM(hProjection)
127
- classTags.write_latPO(hProjection)
128
- classTags.write_falseNE(hProjection)
124
+ classTags.write_standParallel(hProjection, outContext)
125
+ classTags.write_longCM(hProjection, outContext)
126
+ classTags.write_latPO(hProjection, outContext)
127
+ classTags.write_falseNE(hProjection, outContext)
129
128
  end
130
129
  end
131
130
  when 'mercator'
132
131
  @xml.tag!('mapproj') do
133
132
  projectionName = 'Mercator'
134
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
135
133
  classTags.write_name(projectionName)
136
134
  @xml.tag!('mercator') do
137
- if hProjection[:standardParallel1] || hProjection[:standardParallel2]
138
- classTags.write_standParallel(hProjection)
139
- elsif hProjection[:scaleFactorAtEquator]
140
- classTags.write_scaleFactorE(hProjection)
135
+ if hProjection[:scaleFactorAtEquator]
136
+ classTags.write_scaleFactorE(hProjection, outContext)
137
+ else
138
+ classTags.write_standParallel(hProjection, outContext)
141
139
  end
142
- classTags.write_longCM(hProjection)
143
- classTags.write_falseNE(hProjection)
140
+ classTags.write_longCM(hProjection, outContext)
141
+ classTags.write_falseNE(hProjection, outContext)
144
142
  end
145
143
  end
146
144
  when 'miller'
147
145
  @xml.tag!('mapproj') do
148
146
  projectionName = 'Miller Cylindrical'
149
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
150
147
  classTags.write_name(projectionName)
151
148
  @xml.tag!('miller') do
152
- classTags.write_longCM(hProjection)
153
- classTags.write_falseNE(hProjection)
149
+ classTags.write_longCM(hProjection, outContext)
150
+ classTags.write_falseNE(hProjection, outContext)
154
151
  end
155
152
  end
156
153
  when 'obliqueMercator'
157
154
  @xml.tag!('mapproj') do
158
155
  projectionName = 'Oblique Mercator'
159
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
160
156
  classTags.write_name(projectionName)
161
157
  @xml.tag!('obqmerc') do
162
- classTags.write_scaleFactorCL(hProjection)
158
+ classTags.write_scaleFactorCL(hProjection, outContext)
163
159
  if hProjection[:obliqueLinePoints].empty?
164
- classTags.write_obliqueLineAzimuth(hProjection)
160
+ classTags.write_obliqueLineAzimuth(hProjection, outContext)
165
161
  else
166
- @xml.tag!('obqlpt') do
167
- hProjection[:obliqueLinePoints].each do |hLinePt|
168
- classTags.write_obliqueLinePoint(hLinePt)
169
- end
170
- end
162
+ classTags.write_obliqueLinePoint(hProjection, outContext)
171
163
  end
172
- classTags.write_latPO(hProjection)
173
- classTags.write_falseNE(hProjection)
164
+ classTags.write_latPO(hProjection, outContext)
165
+ classTags.write_falseNE(hProjection, outContext)
174
166
  end
175
167
  end
176
168
  when 'orthographic'
177
169
  @xml.tag!('mapproj') do
178
170
  projectionName = 'Orthographic'
179
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
180
171
  classTags.write_name(projectionName)
181
172
  @xml.tag!('orthogr') do
182
- classTags.write_longPC(hProjection)
183
- classTags.write_latPC(hProjection)
184
- classTags.write_falseNE(hProjection)
173
+ classTags.write_longPC(hProjection, outContext)
174
+ classTags.write_latPC(hProjection, outContext)
175
+ classTags.write_falseNE(hProjection, outContext)
185
176
  end
186
177
  end
187
178
  when 'polarStereo'
188
179
  @xml.tag!('mapproj') do
189
180
  projectionName = 'Polar Stereographic'
190
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
191
181
  classTags.write_name(projectionName)
192
182
  @xml.tag!('polarst') do
193
- classTags.write_straightFromPole(hProjection)
183
+ classTags.write_straightFromPole(hProjection, outContext)
194
184
  if hProjection[:standardParallel1] || hProjection[:standardParallel2]
195
- classTags.write_standParallel(hProjection)
196
- elsif hProjection[:scaleFactorAtProjectionOrigin]
197
- classTags.write_scaleFactorPO(hProjection)
185
+ classTags.write_standParallel(hProjection, outContext)
186
+ else hProjection[:scaleFactorAtProjectionOrigin]
187
+ classTags.write_scaleFactorPO(hProjection, outContext)
198
188
  end
199
- classTags.write_falseNE(hProjection)
189
+ classTags.write_falseNE(hProjection, outContext)
200
190
  end
201
191
  end
202
192
  when 'polyconic'
203
193
  @xml.tag!('mapproj') do
204
194
  projectionName = 'Polyconic'
205
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
206
195
  classTags.write_name(projectionName)
207
196
  @xml.tag!('polycon') do
208
- classTags.write_longCM(hProjection)
209
- classTags.write_latPO(hProjection)
210
- classTags.write_falseNE(hProjection)
197
+ classTags.write_longCM(hProjection, outContext)
198
+ classTags.write_latPO(hProjection, outContext)
199
+ classTags.write_falseNE(hProjection, outContext)
211
200
  end
212
201
  end
213
202
  when 'robinson'
214
203
  @xml.tag!('mapproj') do
215
204
  projectionName = 'Robinson'
216
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
217
205
  classTags.write_name(projectionName)
218
206
  @xml.tag!('robinson') do
219
- classTags.write_longPC(hProjection)
220
- classTags.write_falseNE(hProjection)
207
+ classTags.write_longPC(hProjection, outContext)
208
+ classTags.write_falseNE(hProjection, outContext)
221
209
  end
222
210
  end
223
211
  when 'sinusoidal'
224
212
  @xml.tag!('mapproj') do
225
213
  projectionName = 'Sinusoidal'
226
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
227
214
  classTags.write_name(projectionName)
228
215
  @xml.tag!('sinusoid') do
229
- classTags.write_longCM(hProjection)
230
- classTags.write_falseNE(hProjection)
216
+ classTags.write_longCM(hProjection, outContext)
217
+ classTags.write_falseNE(hProjection, outContext)
231
218
  end
232
219
  end
233
220
  when 'spaceOblique'
234
221
  @xml.tag!('mapproj') do
235
222
  projectionName = 'Space Oblique Mercator'
236
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
237
223
  classTags.write_name(projectionName)
238
224
  @xml.tag!('spaceobq') do
239
- classTags.write_landsat(hProjection)
240
- classTags.write_landsatPath(hProjection)
241
- classTags.write_falseNE(hProjection)
225
+ classTags.write_landsat(hProjection, outContext)
226
+ classTags.write_landsatPath(hProjection, outContext)
227
+ classTags.write_falseNE(hProjection, outContext)
242
228
  end
243
229
  end
244
230
  when 'stereographic'
245
231
  @xml.tag!('mapproj') do
246
232
  projectionName = 'Stereographic'
247
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
248
233
  classTags.write_name(projectionName)
249
234
  @xml.tag!('stereo') do
250
- classTags.write_longPC(hProjection)
251
- classTags.write_latPC(hProjection)
252
- classTags.write_falseNE(hProjection)
235
+ classTags.write_longPC(hProjection, outContext)
236
+ classTags.write_latPC(hProjection, outContext)
237
+ classTags.write_falseNE(hProjection, outContext)
253
238
  end
254
239
  end
255
240
  when 'transverseMercator'
256
241
  @xml.tag!('mapproj') do
257
242
  projectionName = 'Transverse Mercator'
258
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
259
243
  classTags.write_name(projectionName)
260
244
  @xml.tag!('transmer') do
261
- classTags.write_scaleFactorCM(hProjection)
262
- classTags.write_longCM(hProjection)
263
- classTags.write_latPO(hProjection)
264
- classTags.write_falseNE(hProjection)
245
+ classTags.write_scaleFactorCM(hProjection, outContext)
246
+ classTags.write_longCM(hProjection, outContext)
247
+ classTags.write_latPO(hProjection, outContext)
248
+ classTags.write_falseNE(hProjection, outContext)
265
249
  end
266
250
  end
267
251
  when 'grinten'
268
252
  @xml.tag!('mapproj') do
269
253
  projectionName = 'Van der Grinten'
270
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
271
254
  classTags.write_name(projectionName)
272
255
  @xml.tag!('vdgrin') do
273
- classTags.write_longCM(hProjection)
274
- classTags.write_falseNE(hProjection)
256
+ classTags.write_longCM(hProjection, outContext)
257
+ classTags.write_falseNE(hProjection, outContext)
275
258
  end
276
259
  end
277
260
  when 'parameters'
278
261
  @xml.tag!('mapproj') do
279
262
  projectionName = 'Map Projection Parameters'
280
- hProjection[:projectionName] = projectionName if hProjection[:projectionName].nil?
281
263
  classTags.write_name(projectionName)
282
264
  @xml.tag!('mapprojp') do
283
- classTags.write_allParams(hProjection)
265
+ classTags.write_allParams(hProjection, outContext)
284
266
  end
285
267
  end
268
+ when 'other'
269
+ @xml.tag!('mapproj') do
270
+ projectionName = 'Other Projection Description'
271
+ classTags.write_name(projectionName)
272
+ classTags.write_otherProjection(hProjection, outContext)
273
+ end
286
274
  end
287
275
 
288
276
  end # writeXML
@@ -2,11 +2,12 @@
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-21 original script
6
7
 
7
8
  require_relative 'class_planarMap'
8
9
  require_relative 'class_planarGrid'
9
- require_relative 'class_planarLocal'
10
+ require_relative 'class_localPlanar'
10
11
  require_relative 'class_planarInfo'
11
12
 
12
13
  module ADIWG
@@ -21,7 +22,7 @@ module ADIWG
21
22
  @hResponseObj = hResponseObj
22
23
  end
23
24
 
24
- def writeXML(aSpaceRefs, aRepTypes, aResolutions)
25
+ def writeXML(aSpaceRefs, aRepTypes, aResolutions, inContext = nil)
25
26
 
26
27
  # classes used
27
28
  classMap = PlanarMap.new(@xml, @hResponseObj)
@@ -29,58 +30,32 @@ module ADIWG
29
30
  classLocal = PlanarLocal.new(@xml, @hResponseObj)
30
31
  classInfo = PlanarInformation.new(@xml, @hResponseObj)
31
32
 
33
+ outContext = 'horizontal planar'
34
+ outContext = inContext + ' ' + outContext unless inContext.nil?
35
+
32
36
  # <- planar 4.1.2 ...
33
37
  # <- spatialReferences[].systemParameterSet.projection (map) 4.1.2.1
34
38
  # <- spatialReferences[].systemParameterSet.projection (grid) 4.1.2.2
35
39
  # <- spatialReferences[].systemParameterSet.projection (localPlanar) 4.1.2.3
36
- # <- planar information 4.1.2.4 ...
37
-
38
- # planar 4.1.2.1 (mapproj) - map projection
39
40
  aSpaceRefs.each do |hSpaceRef|
40
41
  unless hSpaceRef[:systemParameterSet].empty?
41
- if hSpaceRef[:systemParameterSet][:projection]
42
+ unless hSpaceRef[:systemParameterSet][:projection].empty?
42
43
  hProjection = hSpaceRef[:systemParameterSet][:projection]
43
- unless hProjection.empty?
44
- unless hProjection[:projection].nil?
45
- classMap.writeXML(hProjection)
46
- end
44
+ unless hProjection[:gridIdentifier].empty?
45
+ classGrid.writeXML(hProjection, outContext)
46
+ break
47
47
  end
48
- end
49
- end
50
- end
51
-
52
- # planar 4.1.2.2 (gridsys) - grid projection
53
- aSpaceRefs.each do |hSpaceRef|
54
- unless hSpaceRef[:systemParameterSet].empty?
55
- if hSpaceRef[:systemParameterSet][:projection]
56
- hProjection = hSpaceRef[:systemParameterSet][:projection]
57
- unless hProjection.empty?
58
- unless hProjection[:gridSystem].nil?
59
- classGrid.writeXML(hProjection)
60
- end
61
- end
62
- end
63
- end
64
- end
65
-
66
- # planar 4.1.2.3 (localp) - local planar projection
67
- aSpaceRefs.each do |hSpaceRef|
68
- unless hSpaceRef[:systemParameterSet].empty?
69
- if hSpaceRef[:systemParameterSet][:projection]
70
- hProjection = hSpaceRef[:systemParameterSet][:projection]
71
- unless hProjection.empty?
72
- unless hProjection[:projection].nil?
73
- if hProjection[:projection] == 'localPlanar'
74
- classLocal.writeXML(hProjection)
75
- end
76
- end
48
+ if hProjection[:projectionIdentifier][:identifier] == 'localPlanar'
49
+ classLocal.writeXML(hProjection, outContext)
50
+ break
77
51
  end
52
+ classMap.writeXML(hProjection, outContext)
78
53
  end
79
54
  end
80
55
  end
81
56
 
82
- # planar 4.1.2.4 (planci) - local planar projection
83
- classInfo.writeXML(aRepTypes, aResolutions)
57
+ # planar 4.1.2.4 (planci) - planar coordinate information
58
+ classInfo.writeXML(aRepTypes, aResolutions, outContext)
84
59
 
85
60
  end # writeXML
86
61
  end # PlanarReference
@@ -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 2017-12-29 original script
6
7
 
7
8
  require_relative '../fgdc_writer'
@@ -36,6 +37,8 @@ module ADIWG
36
37
  geodeticClass = GeodeticReference.new(@xml, @hResponseObj)
37
38
  vDatumClass = VerticalDatum.new(@xml, @hResponseObj)
38
39
 
40
+ outContext = 'spatial reference'
41
+
39
42
  # spatial reference 4.1 (horizsys) - horizontal coordinate reference system (required)
40
43
  # oneOf [geograph | planar | local]
41
44
  @xml.tag!('horizsys') do
@@ -47,7 +50,7 @@ module ADIWG
47
50
  if hSpaceRes[:geographicResolution]
48
51
  unless hSpaceRes[:geographicResolution].empty?
49
52
  @xml.tag!('geograph') do
50
- geoResClass.writeXML(hSpaceRes[:geographicResolution])
53
+ geoResClass.writeXML(hSpaceRes[:geographicResolution], outContext)
51
54
  end
52
55
  break
53
56
  end
@@ -64,12 +67,10 @@ module ADIWG
64
67
  havePlanar = true unless aRepTypes.empty?
65
68
  aSpaceRefs.each do |hSpaceRef|
66
69
  unless hSpaceRef[:systemParameterSet].empty?
67
- if hSpaceRef[:systemParameterSet][:projection]
70
+ unless hSpaceRef[:systemParameterSet][:projection].empty?
68
71
  hProjection = hSpaceRef[:systemParameterSet][:projection]
69
- unless hProjection.empty?
70
- unless hProjection[:projection] == 'localSystem'
71
- havePlanar = true
72
- end
72
+ unless hProjection[:projectionIdentifier][:identifier] == 'localSystem'
73
+ havePlanar = true
73
74
  end
74
75
  end
75
76
  end
@@ -80,7 +81,7 @@ module ADIWG
80
81
  end
81
82
  if havePlanar
82
83
  @xml.tag!('planar') do
83
- planarClass.writeXML(aSpaceRefs, aRepTypes, aResolutions)
84
+ planarClass.writeXML(aSpaceRefs, aRepTypes, aResolutions, outContext)
84
85
  end
85
86
  end
86
87
 
@@ -95,9 +96,9 @@ module ADIWG
95
96
  if hSpaceRef[:systemParameterSet][:projection]
96
97
  hProjection = hSpaceRef[:systemParameterSet][:projection]
97
98
  unless hProjection.empty?
98
- if hProjection[:projection] == 'localSystem'
99
+ if hProjection[:projectionIdentifier][:identifier] == 'localSystem'
99
100
  @xml.tag!('local') do
100
- localClass.writeXML(hProjection)
101
+ localClass.writeXML(hProjection, outContext)
101
102
  end
102
103
  end
103
104
  end
@@ -113,7 +114,7 @@ module ADIWG
113
114
  hGeodetic = hSpaceRef[:systemParameterSet][:geodetic]
114
115
  unless hGeodetic.empty?
115
116
  @xml.tag!('geodetic') do
116
- geodeticClass.writeXML(hGeodetic)
117
+ geodeticClass.writeXML(hGeodetic, outContext)
117
118
  end
118
119
  end
119
120
  end
@@ -136,7 +137,7 @@ module ADIWG
136
137
  end
137
138
  if haveVertical
138
139
  @xml.tag!('vertdef') do
139
- vDatumClass.writeXML(aSpaceRefs)
140
+ vDatumClass.writeXML(aSpaceRefs, outContext)
140
141
  end
141
142
  end
142
143
 
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-19 refactored for mdJson schema 2.6.0
5
6
  # Stan Smith 2018-03-26 refactored error and warning messaging
6
7
  # Stan Smith 2017-12-12 original script
7
8
 
@@ -53,13 +54,17 @@ module ADIWG
53
54
  @xml.tag!('taxongen')
54
55
  end
55
56
 
56
- # taxonomy bio (taxoncl) - taxonomic classification {required}
57
- unless hTaxonomy[:taxonClass].empty?
57
+ # taxonomy bio (taxoncl) - taxonomic classification [0] {required}
58
+ unless hTaxonomy[:taxonClasses].empty?
58
59
  @xml.tag!('taxoncl') do
59
- taxClassClass.writeXML(hTaxonomy[:taxonClass])
60
+ taxClassClass.writeXML(hTaxonomy[:taxonClasses][0])
60
61
  end
61
62
  end
62
- if hTaxonomy[:taxonClass].empty?
63
+ if hTaxonomy[:taxonClasses].length > 1
64
+ @NameSpace.issueNotice(401)
65
+ @NameSpace.issueNotice(402)
66
+ end
67
+ if hTaxonomy[:taxonClasses].empty?
63
68
  @NameSpace.issueWarning(400, 'taxoncl')
64
69
  end
65
70
 
@@ -56,9 +56,8 @@ module ADIWG
56
56
  @NameSpace.issueWarning(431, nil)
57
57
  end
58
58
 
59
- # taxonomic system (idref) - identification reference [] {identifier}
60
- hTaxonomy[:idReferences].each do |hReference|
61
- hCitation = hReference[:citation]
59
+ # taxonomic system (idref) - identification reference [] {citation}
60
+ hTaxonomy[:idReferences].each do |hCitation|
62
61
  unless hCitation.empty?
63
62
  @xml.tag!('idref') do
64
63
  citationClass.writeXML(hCitation, [])
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-26 deprecate datumName use datumIdentifier.identifier
5
6
  # Stan Smith 2018-03-27 refactored error and warning messaging
6
7
  # Stan Smith 2018-01-16 original script
7
8
 
@@ -18,7 +19,7 @@ module ADIWG
18
19
  @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
19
20
  end
20
21
 
21
- def writeXML(aSpaceRefs)
22
+ def writeXML(aSpaceRefs, inContext = nil)
22
23
 
23
24
  aSpaceRefs.each do |hSpaceRef|
24
25
  unless hSpaceRef[:systemParameterSet].empty?
@@ -30,10 +31,10 @@ module ADIWG
30
31
  @xml.tag!('depthsys') do
31
32
 
32
33
  # vertical datum 4.2.1.1 (depthdn) - depth datum name (required)
33
- unless hVDatum[:datumName].nil?
34
- @xml.tag!('depthdn', hVDatum[:datumName])
34
+ unless hVDatum[:datumIdentifier].empty?
35
+ @xml.tag!('depthdn', hVDatum[:datumIdentifier][:identifier])
35
36
  end
36
- if hVDatum[:datumName].nil?
37
+ if hVDatum[:datumIdentifier].empty?
37
38
  @NameSpace.issueWarning(460, 'depthdn')
38
39
  end
39
40
 
@@ -67,10 +68,10 @@ module ADIWG
67
68
  @xml.tag!('altsys') do
68
69
 
69
70
  # altitude datum 4.2.2.1 (altdatum) - altitude datum name (required)
70
- unless hVDatum[:datumName].nil?
71
- @xml.tag!('altdatum', hVDatum[:datumName])
71
+ unless hVDatum[:datumIdentifier].empty?
72
+ @xml.tag!('altdatum', hVDatum[:datumIdentifier][:identifier])
72
73
  end
73
- if hVDatum[:datumName].nil?
74
+ if hVDatum[:datumIdentifier].empty?
74
75
  @NameSpace.issueWarning(464, 'altdatum')
75
76
  end
76
77