adiwg-mdtranslator 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +12 -6
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +2 -1
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +2 -1
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +2 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +2 -1
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +2 -1
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +2 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +2 -1
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +2 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +2 -1
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +2 -1
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +2 -1
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +2 -1
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +2 -1
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +2 -1
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +2 -1
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +2 -1
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +2 -1
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +2 -1
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +2 -1
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +2 -1
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +2 -1
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +2 -1
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +2 -1
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +82 -0
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +57 -0
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +2 -2
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +12 -113
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +9 -27
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +53 -0
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +1 -0
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +27 -15
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalSystem.rb → module_mapLocalPlanar.rb} +3 -14
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb +1 -1
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +1 -1
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +4 -6
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_verticalReference.rb → module_verticalDatum.rb} +0 -0
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +4 -7
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +95 -0
  43. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +1 -14
  44. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +29 -8
  45. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +5 -5
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -3
  47. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +16 -4
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +8 -23
  49. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +2 -2
  50. data/lib/adiwg/mdtranslator/version.rb +4 -1
  51. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -0
  52. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +6 -1
  53. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -1
  54. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +18 -5
  55. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +62 -0
  56. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +56 -0
  57. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +1 -0
  58. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +45 -0
  59. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +167 -0
  60. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjection.rb +374 -0
  61. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +372 -0
  62. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +1 -0
  63. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +134 -0
  64. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +8 -11
  65. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +8 -8
  66. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +120 -0
  67. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +12 -2
  68. data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +85 -0
  69. data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +5 -1
  70. data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +36 -15
  71. data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +6 -6
  72. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +1 -2
  73. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +7 -0
  74. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +21 -8
  75. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +332 -321
  76. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +8 -8
  77. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +1 -1
  78. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +34 -0
  79. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -2
  80. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReference.rb +1 -0
  81. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReferenceParameters.rb +2 -2
  82. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +1 -1
  83. metadata +20 -9
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_ellipsoid.rb +0 -78
  85. data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +0 -68
  86. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_ellipsoidParameters.rb +0 -32
@@ -24,17 +24,38 @@ module ADIWG
24
24
  identifierClass = Html_Identifier.new(@html)
25
25
  linePointClass = Html_ObliqueLinePoint.new()
26
26
 
27
- # projection parameters - projection name
28
- unless hProjection[:projectionName].nil?
29
- @html.em('Projection Name: ')
30
- @html.text!(hProjection[:projectionName])
27
+ # projection parameters - grid system
28
+ unless hProjection[:gridSystem].nil?
29
+ @html.em('Grid System: ')
30
+ @html.text!(hProjection[:gridSystem])
31
+ @html.br
32
+ end
33
+
34
+ # projection parameters - grid system name
35
+ unless hProjection[:gridSystemName].nil?
36
+ @html.em('Grid System Name: ')
37
+ @html.text!(hProjection[:gridSystemName])
31
38
  @html.br
32
39
  end
33
40
 
34
41
  # projection parameters - zone
35
- unless hProjection[:zone].nil?
36
- @html.em('Projection Zone: ')
37
- @html.text!(hProjection[:zone])
42
+ unless hProjection[:gridZone].nil?
43
+ @html.em('Grid System Zone: ')
44
+ @html.text!(hProjection[:gridZone])
45
+ @html.br
46
+ end
47
+
48
+ # projection parameters - projection
49
+ unless hProjection[:projection].nil?
50
+ @html.em('Projection: ')
51
+ @html.text!(hProjection[:projection])
52
+ @html.br
53
+ end
54
+
55
+ # projection parameters - projection name
56
+ unless hProjection[:projectionName].nil?
57
+ @html.em('Projection Name: ')
58
+ @html.text!(hProjection[:projectionName])
38
59
  @html.br
39
60
  end
40
61
 
@@ -194,14 +215,6 @@ module ADIWG
194
215
  end
195
216
  end
196
217
 
197
- # projection parameters - other projection description
198
- unless hProjection[:otherProjectionDescription].nil?
199
- @html.em('Other Projection Description: ')
200
- @html.section(:class => 'block') do
201
- @html.text!(hProjection[:otherProjectionDescription])
202
- end
203
- end
204
-
205
218
  # projection parameters - other grid description
206
219
  unless hProjection[:otherGridDescription].nil?
207
220
  @html.em('Other Grid Description: ')
@@ -210,6 +223,14 @@ module ADIWG
210
223
  end
211
224
  end
212
225
 
226
+ # projection parameters - other projection description
227
+ unless hProjection[:otherProjectionDescription].nil?
228
+ @html.em('Other Projection Description: ')
229
+ @html.section(:class => 'block') do
230
+ @html.text!(hProjection[:otherProjectionDescription])
231
+ end
232
+ end
233
+
213
234
  # projection parameters - projection identifier
214
235
  unless hProjection[:projectionIdentifier].empty?
215
236
  @html.details do
@@ -5,7 +5,7 @@
5
5
  # Stan Smith 2017-10-24 original script
6
6
 
7
7
  require_relative 'html_projectionParameters'
8
- require_relative 'html_ellipsoidParameters'
8
+ require_relative 'html_geodeticParameters'
9
9
  require_relative 'html_verticalDatumParameters'
10
10
 
11
11
  module ADIWG
@@ -23,7 +23,7 @@ module ADIWG
23
23
 
24
24
  # classes used
25
25
  projectionClass = Html_ProjectionParameters.new(@html)
26
- ellipsoidClass = Html_EllipsoidParameters.new(@html)
26
+ ellipsoidClass = Html_GeodeticParameters.new(@html)
27
27
  verticalClass = Html_VerticalDatumParameters.new(@html)
28
28
 
29
29
  # reference parameter set - projection
@@ -36,12 +36,12 @@ module ADIWG
36
36
  end
37
37
  end
38
38
 
39
- # reference parameter set - ellipsoid
40
- unless hParamSet[:ellipsoid].empty?
39
+ # reference parameter set - geodetic
40
+ unless hParamSet[:geodetic].empty?
41
41
  @html.details do
42
- @html.summary('Ellipsoid Parameters', {'id' => 'ellipsoid', 'class' => 'h5'})
42
+ @html.summary('Geodetic Parameters', {'id' => 'geodetic', 'class' => 'h5'})
43
43
  @html.section(:class => 'block') do
44
- ellipsoidClass.writeHtml(hParamSet[:ellipsoid])
44
+ ellipsoidClass.writeHtml(hParamSet[:geodetic])
45
45
  end
46
46
  end
47
47
  end
@@ -321,8 +321,7 @@ module ADIWG
321
321
  end
322
322
 
323
323
  # resource - keywords [] {keyword}
324
- unless hResource[:topicCategories].empty? &&
325
- hResource[:keywords].empty?
324
+ unless hResource[:keywords].empty?
326
325
  @html.details do
327
326
  @html.summary('Keywords', {'id' => 'resourceInfo-keyword', 'class' => 'h3'})
328
327
  @html.section(:class => 'block') do
@@ -30,6 +30,13 @@ module ADIWG
30
30
  end
31
31
  @html.br
32
32
 
33
+ # vertical datum - datum name
34
+ unless hDatum[:datumName].nil?
35
+ @html.em('Datum Name: ')
36
+ @html.text!(hDatum[:datumName])
37
+ @html.br
38
+ end
39
+
33
40
  # vertical datum - encoding method
34
41
  unless hDatum[:encodingMethod].nil?
35
42
  @html.em('Encoding Method: ')
@@ -41,39 +41,52 @@ module ADIWG
41
41
  @xml.tag!('gmd:projection')
42
42
  end
43
43
 
44
- # ellipsoid identifier {rsIdentifier}
45
- unless hParamSet[:ellipsoid].empty?
46
- hIdentifier = hParamSet[:ellipsoid][:ellipsoidIdentifier]
44
+ # geodetic ellipsoid identifier {rsIdentifier}
45
+ unless hParamSet[:geodetic].empty?
46
+ hIdentifier = hParamSet[:geodetic][:ellipsoidIdentifier]
47
47
  unless hIdentifier.empty?
48
48
  @xml.tag!('gmd:ellipsoid') do
49
49
  idClass.writeXML(hIdentifier)
50
50
  end
51
51
  end
52
52
  end
53
- if hParamSet[:ellipsoid] && @hResponseObj[:writerShowTags]
53
+ if hParamSet[:geodetic].empty? && @hResponseObj[:writerShowTags]
54
54
  @xml.tag!('gmd:ellipsoid')
55
55
  end
56
56
 
57
+ haveDatum = false
58
+ # geodetic datum identifier {rsIdentifier}
59
+ unless hParamSet[:geodetic].empty?
60
+ hIdentifier = hParamSet[:geodetic][:datumIdentifier]
61
+ unless hIdentifier.empty?
62
+ @xml.tag!('gmd:datum') do
63
+ idClass.writeXML(hIdentifier)
64
+ haveDatum = true
65
+ end
66
+ end
67
+ end
68
+
57
69
  # vertical datum identifier {rsIdentifier}
58
70
  unless hParamSet[:verticalDatum].empty?
59
71
  hIdentifier = hParamSet[:verticalDatum][:datumIdentifier]
60
72
  unless hIdentifier.empty?
61
73
  @xml.tag!('gmd:datum') do
62
74
  idClass.writeXML(hIdentifier)
75
+ haveDatum = true
63
76
  end
64
77
  end
65
78
  end
66
- if hParamSet[:verticalDatum].empty? && @hResponseObj[:writerShowTags]
79
+ if !haveDatum && @hResponseObj[:writerShowTags]
67
80
  @xml.tag!('gmd:datum')
68
81
  end
69
82
 
70
83
  # ellipsoid parameters
71
- unless hParamSet[:ellipsoid].empty?
84
+ unless hParamSet[:geodetic].empty?
72
85
  @xml.tag!('gmd:ellipsoidParameters') do
73
- ellipsoidClass.writeXML(hParamSet[:ellipsoid])
86
+ ellipsoidClass.writeXML(hParamSet[:geodetic])
74
87
  end
75
88
  end
76
- if hParamSet[:ellipsoid].empty? && @hResponseObj[:writerShowTags]
89
+ if hParamSet[:geodetic].empty? && @hResponseObj[:writerShowTags]
77
90
  @xml.tag!('gmd:ellipsoidParameters')
78
91
  end
79
92
 
@@ -2,19 +2,21 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-07-30 added support for translating locale into language and characterSet
7
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
10
- # Stan Smith 2015-06-12 added support for declaring multiple resource character sets
11
- # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
12
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
13
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
14
- # Stan Smith 2014-10-29 add resource time period as a extent temporal element
15
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
16
- # Stan Smith 2014-05-21 added aggregate information section
17
- # Stan Smith 2014-05-15 modify to support JSON schema version 0.4.0
5
+ # Stan Smith 2018-01-05 deprecated topicCategory[]
6
+ # Stan Smith 2018-01-05 get topics from keywords where type='isoTopicCategory'
7
+ # Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
8
+ # Stan Smith 2015-07-30 added support for translating locale into language and characterSet
9
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
10
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
11
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
12
+ # Stan Smith 2015-06-12 added support for declaring multiple resource character sets
13
+ # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
14
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
15
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
16
+ # Stan Smith 2014-10-29 add resource time period as a extent temporal element
17
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
18
+ # Stan Smith 2014-05-21 added aggregate information section
19
+ # Stan Smith 2014-05-15 modify to support JSON schema version 0.4.0
18
20
  # Stan Smith 2013-11-25 add spatial resolution
19
21
  # Stan Smith 2013-11-25 add resource usage
20
22
  # Stan Smith 2013-11-22 add metadata extension
@@ -42,312 +44,321 @@ require_relative 'class_resolution'
42
44
  require_relative 'class_extent'
43
45
 
44
46
  module ADIWG
45
- module Mdtranslator
46
- module Writers
47
- module Iso19115_2
48
-
49
- class MD_DataIdentification
50
-
51
- def initialize(xml, hResponseObj)
52
- @xml = xml
53
- @hResponseObj = hResponseObj
54
- end
55
-
56
- def writeXML(hData, aAssocRes)
57
-
58
- # classes used
59
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
60
- enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
61
- citationClass = CI_Citation.new(@xml, @hResponseObj)
62
- rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
63
- mInfoClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
64
- bGraphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
65
- rFormatClass = MD_Format.new(@xml, @hResponseObj)
66
- keywordClass = MD_Keywords.new(@xml, @hResponseObj)
67
- useClass = MD_Usage.new(@xml, @hResponseObj)
68
- uConClass = MD_Constraints.new(@xml, @hResponseObj)
69
- lConClass = MD_LegalConstraints.new(@xml, @hResponseObj)
70
- sConClass = MD_SecurityConstraints.new(@xml, @hResponseObj)
71
- aggInfoClass = MD_AggregateInformation.new(@xml, @hResponseObj)
72
- taxClass = MD_TaxonSys.new(@xml, @hResponseObj)
73
- resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
74
- extentClass = EX_Extent.new(@xml, @hResponseObj)
75
-
76
- # data identification
77
- @xml.tag!('gmd:MD_DataIdentification') do
78
-
79
- # data identification - citation {CI_Citation} (required)
80
- hCitation = hData[:citation]
81
- unless hCitation.empty?
82
- @xml.tag!('gmd:citation') do
83
- citationClass.writeXML(hCitation)
84
- end
85
- end
86
- if hCitation.empty?
87
- @xml.tag!('gmd:citation', {'gco:nilReason' => 'missing'})
88
- end
89
-
90
- # data identification - abstract (required)
91
- s = hData[:abstract]
92
- unless s.nil?
93
- @xml.tag!('gmd:abstract') do
94
- @xml.tag!('gco:CharacterString', s)
95
- end
96
- end
97
- if s.nil?
98
- @xml.tag!('gmd:abstract', {'gco:nilReason' => 'missing'})
99
- end
100
-
101
- # data identification - purpose
102
- s = hData[:purpose]
103
- unless s.nil?
104
- @xml.tag!('gmd:purpose') do
105
- @xml.tag!('gco:CharacterString', s)
106
- end
107
- end
108
- if s.nil? && @hResponseObj[:writerShowTags]
109
- @xml.tag!('gmd:purpose')
110
- end
111
-
112
- # data identification - credit []
113
- aCredits = hData[:credits]
114
- aCredits.each do |credit|
115
- @xml.tag!('gmd:credit') do
116
- @xml.tag!('gco:CharacterString', credit)
117
- end
118
- end
119
- if aCredits.empty? && @hResponseObj[:writerShowTags]
120
- @xml.tag!('gmd:credit')
121
- end
122
-
123
- # data identification - status []
124
- aStatus = hData[:status]
125
- aStatus.each do |code|
126
- @xml.tag!('gmd:status') do
127
- codelistClass.writeXML('gmd', 'iso_progress', code)
128
- end
129
- end
130
- if aStatus.empty? && @hResponseObj[:writerShowTags]
131
- @xml.tag!('gmd:status')
132
- end
133
-
134
- # data identification - point of contact
135
- aRParties = hData[:pointOfContacts]
136
- aRParties.each do |hRParty|
137
- role = hRParty[:roleName]
138
- aParties = hRParty[:parties]
139
- aParties.each do |hParty|
140
- @xml.tag!('gmd:pointOfContact') do
141
- rPartyClass.writeXML(role, hParty)
142
- end
143
- end
144
- end
145
- if aRParties.empty? && @hResponseObj[:writerShowTags]
146
- @xml.tag!('gmd:pointOfContact', {'gco:nilReason' => 'missing'})
147
- end
148
-
149
- # data identification - resource maintenance []
150
- aMaint = hData[:resourceMaintenance]
151
- aMaint.each do |hMaint|
152
- @xml.tag!('gmd:resourceMaintenance') do
153
- mInfoClass.writeXML(hMaint)
154
- end
155
- end
156
- if aMaint.empty? && @hResponseObj[:writerShowTags]
157
- @xml.tag!('gmd:resourceMaintenance')
158
- end
159
-
160
- # data identification - graphic overview []
161
- aGraphics = hData[:graphicOverviews]
162
- aGraphics.each do |hGraphic|
163
- @xml.tag!('gmd:graphicOverview') do
164
- bGraphicClass.writeXML(hGraphic)
165
- end
166
- end
167
- if aGraphics.empty? && @hResponseObj[:writerShowTags]
168
- @xml.tag!('gmd:graphicOverview')
169
- end
170
-
171
- # data identification - resource format []
172
- aFormats = hData[:resourceFormats]
173
- aFormats.each do |hResFormat|
174
- @xml.tag!('gmd:resourceFormat') do
175
- rFormatClass.writeXML(hResFormat)
176
- end
177
- end
178
- if aFormats.empty? && @hResponseObj[:writerShowTags]
179
- @xml.tag!('gmd:resourceFormat')
180
- end
181
-
182
- # data identification - descriptive keywords []
183
- aKeywords = hData[:keywords]
184
- aKeywords.each do |hKeyword|
185
- @xml.tag!('gmd:descriptiveKeywords') do
186
- keywordClass.writeXML(hKeyword)
187
- end
188
- end
189
- if aKeywords.empty? && @hResponseObj[:writerShowTags]
190
- @xml.tag!('gmd:descriptiveKeywords')
191
- end
192
-
193
- # data identification - resource specific usage []
194
- aUses = hData[:resourceUsages]
195
- aUses.each do |hResUse|
196
- @xml.tag!('gmd:resourceSpecificUsage') do
197
- useClass.writeXML(hResUse)
198
- end
199
- end
200
- if aUses.empty? && @hResponseObj[:writerShowTags]
201
- @xml.tag!('gmd:resourceSpecificUsage')
202
- end
203
-
204
- # data identification - resource constraints {}
205
- aCons = hData[:constraints]
206
- aCons.each do |hCon|
207
- @xml.tag!('gmd:resourceConstraints') do
208
- type = hCon[:type]
209
- if type == 'use'
210
- uConClass.writeXML(hCon)
211
- end
212
- if type == 'legal'
213
- lConClass.writeXML(hCon)
214
- end
215
- if type == 'security'
216
- sConClass.writeXML(hCon)
217
- end
218
- end
219
- end
220
- if aCons.nil? && @hResponseObj[:writerShowTags]
221
- @xml.tag!('gmd:resourceConstraints')
222
- end
223
-
224
- # data identification - aggregate information []
225
- aAssocRes.each do |hAssocRes|
226
- @xml.tag!('gmd:aggregationInfo') do
227
- aggInfoClass.writeXML(hAssocRes)
228
- end
229
- end
230
- if aAssocRes.empty? && @hResponseObj[:writerShowTags]
231
- @xml.tag!('gmd:aggregationInfo')
232
- end
233
-
234
- # data identification - taxonomy
235
- hTaxonomy = hData[:taxonomy]
236
- unless hTaxonomy.empty?
237
- @xml.tag!('gmd:taxonomy') do
238
- taxClass.writeXML(hTaxonomy)
239
- end
240
- end
241
- if hTaxonomy.empty? && @hResponseObj[:writerShowTags]
242
- @xml.tag!('gmd:taxonomy')
243
- end
244
-
245
- # data identification - spatial representation type []
246
- aSpatialType = hData[:spatialRepresentationTypes]
247
- aSpatialType.each do |spType|
248
- @xml.tag!('gmd:spatialRepresentationType') do
249
- codelistClass.writeXML('gmd', 'iso_spatialRepresentation',spType)
250
- end
251
- end
252
- if aSpatialType.empty? && @hResponseObj[:writerShowTags]
253
- @xml.tag!('gmd:spatialRepresentationType')
254
- end
255
-
256
- # data identification - spatial resolution []
257
- aSpatialRes = hData[:spatialResolutions]
258
- aSpatialRes.each do |hSpRes|
259
- @xml.tag!('gmd:spatialResolution') do
260
- resolutionClass.writeXML(hSpRes)
261
- end
262
- end
263
- if aSpatialRes.empty? && @hResponseObj[:writerShowTags]
264
- @xml.tag!('gmd:spatialResolution')
265
- end
266
-
267
- # data identification - language [] (required)
268
- aLocale = hData[:otherResourceLocales]
269
- aLocale.insert(0, hData[:defaultResourceLocale])
270
- aLocale.each do |hLocale|
271
- s = hLocale[:languageCode]
272
- unless hLocale[:countryCode].nil?
273
- s += '; ' + hLocale[:countryCode]
274
- end
275
- @xml.tag!('gmd:language') do
276
- @xml.tag!('gco:CharacterString', s)
277
- end
278
- end
279
- if aLocale.empty?
280
- @xml.tag!('gmd:language') do
281
- @xml.tag!('gco:CharacterString', 'eng; USA')
282
- end
283
- end
284
-
285
- # data identification - characterSet [] (default 'utf8')
286
- charSets = 0
287
- aLocale.each do |hLocale|
288
- s = hLocale[:characterEncoding]
289
- unless s.nil?
290
- @xml.tag!('gmd:characterSet') do
291
- codelistClass.writeXML('gmd', 'iso_characterSet', s)
292
- charSets += 1
293
- end
294
- end
295
- end
296
- if charSets == 0
297
- @xml.tag!('gmd:language') do
298
- @xml.tag!('gco:CharacterString', 'eng; USA')
299
- end
300
- end
301
-
302
- # data identification - topic category []
303
- aTopics = hData[:topicCategories]
304
- aTopics.each do |spType|
305
- @xml.tag!('gmd:topicCategory') do
306
- enumerationClass.writeXML('iso_topicCategory', spType)
307
- end
308
- end
309
- if aTopics.empty? && @hResponseObj[:writerShowTags]
310
- @xml.tag!('gmd:topicCategory')
311
- end
312
-
313
- # data identification - environment description
314
- s = hData[:environmentDescription]
315
- unless s.nil?
316
- @xml.tag!('gmd:environmentDescription') do
317
- @xml.tag!('gco:CharacterString', s)
318
- end
319
- end
320
- if s.nil? && @hResponseObj[:writerShowTags]
321
- @xml.tag!('gmd:environmentDescription')
322
- end
323
-
324
- # data identification - extent []
325
- aExtents = hData[:extents]
326
- aExtents.each do |hExtent|
327
- @xml.tag!('gmd:extent') do
328
- extentClass.writeXML(hExtent)
329
- end
330
- end
331
- if aExtents.empty? && @hResponseObj[:writerShowTags]
332
- @xml.tag!('gmd:extent')
333
- end
334
-
335
- # data identification - supplemental info
336
- s = hData[:supplementalInfo]
337
- unless s.nil?
338
- @xml.tag!('gmd:supplementalInformation') do
339
- @xml.tag!('gco:CharacterString', s)
340
- end
341
- end
342
- if s.nil? && @hResponseObj[:writerShowTags]
343
- @xml.tag!('gmd:supplementalInformation')
344
- end
345
-
346
- end # gmd:MD_DataIdentification tag
347
- end # writeXML
348
- end # MD_DataIdentification class
349
-
350
- end
351
- end
352
- end
47
+ module Mdtranslator
48
+ module Writers
49
+ module Iso19115_2
50
+
51
+ class MD_DataIdentification
52
+
53
+ def initialize(xml, hResponseObj)
54
+ @xml = xml
55
+ @hResponseObj = hResponseObj
56
+ end
57
+
58
+ def writeXML(hData, aAssocRes)
59
+
60
+ # classes used
61
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
62
+ enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
63
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
64
+ rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
65
+ mInfoClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
66
+ bGraphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
67
+ rFormatClass = MD_Format.new(@xml, @hResponseObj)
68
+ keywordClass = MD_Keywords.new(@xml, @hResponseObj)
69
+ useClass = MD_Usage.new(@xml, @hResponseObj)
70
+ uConClass = MD_Constraints.new(@xml, @hResponseObj)
71
+ lConClass = MD_LegalConstraints.new(@xml, @hResponseObj)
72
+ sConClass = MD_SecurityConstraints.new(@xml, @hResponseObj)
73
+ aggInfoClass = MD_AggregateInformation.new(@xml, @hResponseObj)
74
+ taxClass = MD_TaxonSys.new(@xml, @hResponseObj)
75
+ resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
76
+ extentClass = EX_Extent.new(@xml, @hResponseObj)
77
+
78
+ # data identification
79
+ @xml.tag!('gmd:MD_DataIdentification') do
80
+
81
+ # data identification - citation {CI_Citation} (required)
82
+ hCitation = hData[:citation]
83
+ unless hCitation.empty?
84
+ @xml.tag!('gmd:citation') do
85
+ citationClass.writeXML(hCitation)
86
+ end
87
+ end
88
+ if hCitation.empty?
89
+ @xml.tag!('gmd:citation', {'gco:nilReason' => 'missing'})
90
+ end
91
+
92
+ # data identification - abstract (required)
93
+ s = hData[:abstract]
94
+ unless s.nil?
95
+ @xml.tag!('gmd:abstract') do
96
+ @xml.tag!('gco:CharacterString', s)
97
+ end
98
+ end
99
+ if s.nil?
100
+ @xml.tag!('gmd:abstract', {'gco:nilReason' => 'missing'})
101
+ end
102
+
103
+ # data identification - purpose
104
+ s = hData[:purpose]
105
+ unless s.nil?
106
+ @xml.tag!('gmd:purpose') do
107
+ @xml.tag!('gco:CharacterString', s)
108
+ end
109
+ end
110
+ if s.nil? && @hResponseObj[:writerShowTags]
111
+ @xml.tag!('gmd:purpose')
112
+ end
113
+
114
+ # data identification - credit []
115
+ aCredits = hData[:credits]
116
+ aCredits.each do |credit|
117
+ @xml.tag!('gmd:credit') do
118
+ @xml.tag!('gco:CharacterString', credit)
119
+ end
120
+ end
121
+ if aCredits.empty? && @hResponseObj[:writerShowTags]
122
+ @xml.tag!('gmd:credit')
123
+ end
124
+
125
+ # data identification - status []
126
+ aStatus = hData[:status]
127
+ aStatus.each do |code|
128
+ @xml.tag!('gmd:status') do
129
+ codelistClass.writeXML('gmd', 'iso_progress', code)
130
+ end
131
+ end
132
+ if aStatus.empty? && @hResponseObj[:writerShowTags]
133
+ @xml.tag!('gmd:status')
134
+ end
135
+
136
+ # data identification - point of contact
137
+ aRParties = hData[:pointOfContacts]
138
+ aRParties.each do |hRParty|
139
+ role = hRParty[:roleName]
140
+ aParties = hRParty[:parties]
141
+ aParties.each do |hParty|
142
+ @xml.tag!('gmd:pointOfContact') do
143
+ rPartyClass.writeXML(role, hParty)
144
+ end
145
+ end
146
+ end
147
+ if aRParties.empty? && @hResponseObj[:writerShowTags]
148
+ @xml.tag!('gmd:pointOfContact', {'gco:nilReason' => 'missing'})
149
+ end
150
+
151
+ # data identification - resource maintenance []
152
+ aMaint = hData[:resourceMaintenance]
153
+ aMaint.each do |hMaint|
154
+ @xml.tag!('gmd:resourceMaintenance') do
155
+ mInfoClass.writeXML(hMaint)
156
+ end
157
+ end
158
+ if aMaint.empty? && @hResponseObj[:writerShowTags]
159
+ @xml.tag!('gmd:resourceMaintenance')
160
+ end
161
+
162
+ # data identification - graphic overview []
163
+ aGraphics = hData[:graphicOverviews]
164
+ aGraphics.each do |hGraphic|
165
+ @xml.tag!('gmd:graphicOverview') do
166
+ bGraphicClass.writeXML(hGraphic)
167
+ end
168
+ end
169
+ if aGraphics.empty? && @hResponseObj[:writerShowTags]
170
+ @xml.tag!('gmd:graphicOverview')
171
+ end
172
+
173
+ # data identification - resource format []
174
+ aFormats = hData[:resourceFormats]
175
+ aFormats.each do |hResFormat|
176
+ @xml.tag!('gmd:resourceFormat') do
177
+ rFormatClass.writeXML(hResFormat)
178
+ end
179
+ end
180
+ if aFormats.empty? && @hResponseObj[:writerShowTags]
181
+ @xml.tag!('gmd:resourceFormat')
182
+ end
183
+
184
+ # data identification - descriptive keywords []
185
+ aKeywords = hData[:keywords]
186
+ aKeywords.each do |hKeyword|
187
+ @xml.tag!('gmd:descriptiveKeywords') do
188
+ keywordClass.writeXML(hKeyword)
189
+ end
190
+ end
191
+ if aKeywords.empty? && @hResponseObj[:writerShowTags]
192
+ @xml.tag!('gmd:descriptiveKeywords')
193
+ end
194
+
195
+ # data identification - resource specific usage []
196
+ aUses = hData[:resourceUsages]
197
+ aUses.each do |hResUse|
198
+ @xml.tag!('gmd:resourceSpecificUsage') do
199
+ useClass.writeXML(hResUse)
200
+ end
201
+ end
202
+ if aUses.empty? && @hResponseObj[:writerShowTags]
203
+ @xml.tag!('gmd:resourceSpecificUsage')
204
+ end
205
+
206
+ # data identification - resource constraints {}
207
+ aCons = hData[:constraints]
208
+ aCons.each do |hCon|
209
+ @xml.tag!('gmd:resourceConstraints') do
210
+ type = hCon[:type]
211
+ if type == 'use'
212
+ uConClass.writeXML(hCon)
213
+ end
214
+ if type == 'legal'
215
+ lConClass.writeXML(hCon)
216
+ end
217
+ if type == 'security'
218
+ sConClass.writeXML(hCon)
219
+ end
220
+ end
221
+ end
222
+ if aCons.nil? && @hResponseObj[:writerShowTags]
223
+ @xml.tag!('gmd:resourceConstraints')
224
+ end
225
+
226
+ # data identification - aggregate information []
227
+ aAssocRes.each do |hAssocRes|
228
+ @xml.tag!('gmd:aggregationInfo') do
229
+ aggInfoClass.writeXML(hAssocRes)
230
+ end
231
+ end
232
+ if aAssocRes.empty? && @hResponseObj[:writerShowTags]
233
+ @xml.tag!('gmd:aggregationInfo')
234
+ end
235
+
236
+ # data identification - taxonomy
237
+ hTaxonomy = hData[:taxonomy]
238
+ unless hTaxonomy.empty?
239
+ @xml.tag!('gmd:taxonomy') do
240
+ taxClass.writeXML(hTaxonomy)
241
+ end
242
+ end
243
+ if hTaxonomy.empty? && @hResponseObj[:writerShowTags]
244
+ @xml.tag!('gmd:taxonomy')
245
+ end
246
+
247
+ # data identification - spatial representation type []
248
+ aSpatialType = hData[:spatialRepresentationTypes]
249
+ aSpatialType.each do |spType|
250
+ @xml.tag!('gmd:spatialRepresentationType') do
251
+ codelistClass.writeXML('gmd', 'iso_spatialRepresentation', spType)
252
+ end
253
+ end
254
+ if aSpatialType.empty? && @hResponseObj[:writerShowTags]
255
+ @xml.tag!('gmd:spatialRepresentationType')
256
+ end
257
+
258
+ # data identification - spatial resolution []
259
+ aSpatialRes = hData[:spatialResolutions]
260
+ aSpatialRes.each do |hSpRes|
261
+ @xml.tag!('gmd:spatialResolution') do
262
+ resolutionClass.writeXML(hSpRes)
263
+ end
264
+ end
265
+ if aSpatialRes.empty? && @hResponseObj[:writerShowTags]
266
+ @xml.tag!('gmd:spatialResolution')
267
+ end
268
+
269
+ # data identification - language [] (required)
270
+ aLocale = hData[:otherResourceLocales]
271
+ aLocale.insert(0, hData[:defaultResourceLocale])
272
+ aLocale.each do |hLocale|
273
+ s = hLocale[:languageCode]
274
+ unless hLocale[:countryCode].nil?
275
+ s += '; ' + hLocale[:countryCode]
276
+ end
277
+ @xml.tag!('gmd:language') do
278
+ @xml.tag!('gco:CharacterString', s)
279
+ end
280
+ end
281
+ if aLocale.empty?
282
+ @xml.tag!('gmd:language') do
283
+ @xml.tag!('gco:CharacterString', 'eng; USA')
284
+ end
285
+ end
286
+
287
+ # data identification - characterSet [] (default 'utf8')
288
+ charSets = 0
289
+ aLocale.each do |hLocale|
290
+ s = hLocale[:characterEncoding]
291
+ unless s.nil?
292
+ @xml.tag!('gmd:characterSet') do
293
+ codelistClass.writeXML('gmd', 'iso_characterSet', s)
294
+ charSets += 1
295
+ end
296
+ end
297
+ end
298
+ if charSets == 0
299
+ @xml.tag!('gmd:language') do
300
+ @xml.tag!('gco:CharacterString', 'eng; USA')
301
+ end
302
+ end
303
+
304
+ # data identification - topic category []
305
+ # <- hData.keywords where keywordType='isoTopicCategory'
306
+ aTopics = []
307
+ aKeywords = hData[:keywords]
308
+ aKeywords.each do |hKeyword|
309
+ if hKeyword[:keywordType] == 'isoTopicCategory'
310
+ hKeyword[:keywords].each do |hKeyObj|
311
+ aTopics << hKeyObj[:keyword]
312
+ end
313
+ end
314
+ end
315
+ aTopics.each do |topic|
316
+ @xml.tag!('gmd:topicCategory') do
317
+ enumerationClass.writeXML('iso_topicCategory', topic)
318
+ end
319
+ end
320
+ if aTopics.empty? && @hResponseObj[:writerShowTags]
321
+ @xml.tag!('gmd:topicCategory')
322
+ end
323
+
324
+ # data identification - environment description
325
+ s = hData[:environmentDescription]
326
+ unless s.nil?
327
+ @xml.tag!('gmd:environmentDescription') do
328
+ @xml.tag!('gco:CharacterString', s)
329
+ end
330
+ end
331
+ if s.nil? && @hResponseObj[:writerShowTags]
332
+ @xml.tag!('gmd:environmentDescription')
333
+ end
334
+
335
+ # data identification - extent []
336
+ aExtents = hData[:extents]
337
+ aExtents.each do |hExtent|
338
+ @xml.tag!('gmd:extent') do
339
+ extentClass.writeXML(hExtent)
340
+ end
341
+ end
342
+ if aExtents.empty? && @hResponseObj[:writerShowTags]
343
+ @xml.tag!('gmd:extent')
344
+ end
345
+
346
+ # data identification - supplemental info
347
+ s = hData[:supplementalInfo]
348
+ unless s.nil?
349
+ @xml.tag!('gmd:supplementalInformation') do
350
+ @xml.tag!('gco:CharacterString', s)
351
+ end
352
+ end
353
+ if s.nil? && @hResponseObj[:writerShowTags]
354
+ @xml.tag!('gmd:supplementalInformation')
355
+ end
356
+
357
+ end # gmd:MD_DataIdentification tag
358
+ end # writeXML
359
+ end # MD_DataIdentification class
360
+
361
+ end
362
+ end
363
+ end
353
364
  end