adiwg-mdtranslator 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +20 -5
  4. data/Rakefile +2 -0
  5. data/adiwg-mdtranslator.gemspec +2 -1
  6. data/lib/adiwg/mdtranslator.rb +1 -0
  7. data/lib/adiwg/mdtranslator/internal/module_codelistFun.rb +26 -0
  8. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +3 -0
  9. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +1 -1
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +0 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +0 -1
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +2 -4
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +0 -1
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +0 -2
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +0 -2
  17. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +0 -1
  18. data/lib/adiwg/mdtranslator/version.rb +3 -2
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +0 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +0 -1
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +0 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +0 -1
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +1 -1
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +0 -1
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +0 -1
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +1 -3
  28. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_additionalDocument.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb +90 -0
  30. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_associatedResource.rb +84 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attribute.rb +107 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb +69 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_baseUnit.rb +38 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_boundingBox.rb +70 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_browseGraphic.rb +95 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_citation.rb +205 -0
  37. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_codelist.rb +50 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraint.rb +51 -0
  39. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraintCommon.rb +104 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_contact.rb +119 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_conventionalUnit.rb +64 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_coverageDescription.rb +84 -0
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataIdentification.rb +347 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_date.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_definitionUnit.rb +35 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_derivedUnit.rb +42 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dimension.rb +72 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distribution.rb +62 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distributor.rb +77 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_email.rb +44 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_extent.rb +85 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_feature.rb +71 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb +56 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureProperties.rb +64 -0
  55. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_format.rb +74 -0
  56. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_fraction.rb +46 -0
  57. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gcoDateTime.rb +45 -0
  58. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicElement.rb +77 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicExtent.rb +96 -0
  60. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometricObjects.rb +60 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometryCollection.rb +97 -0
  62. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +121 -0
  63. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +87 -0
  64. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gmlIdentifier.rb +32 -0
  65. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +71 -0
  66. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gridRepresentation.rb +36 -0
  67. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +95 -0
  68. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_imageDescription.rb +175 -0
  69. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +85 -0
  70. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_keyword.rb +78 -0
  71. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_legalConstraints.rb +87 -0
  72. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineString.rb +76 -0
  73. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +97 -0
  74. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_locale.rb +67 -0
  75. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_maintenance.rb +101 -0
  76. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdBand.rb +82 -0
  77. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +372 -0
  78. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_measure.rb +71 -0
  79. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_medium.rb +113 -0
  80. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_miBand.rb +90 -0
  81. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiLine.rb +84 -0
  82. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPoint.rb +84 -0
  83. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPolygon.rb +84 -0
  84. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +91 -0
  85. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb +79 -0
  86. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +106 -0
  87. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb +81 -0
  88. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb +77 -0
  89. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb +95 -0
  90. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +130 -0
  91. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb +94 -0
  92. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb +92 -0
  93. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb +71 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb +97 -0
  95. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_responsibility.rb +91 -0
  96. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +127 -0
  97. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scope.rb +75 -0
  98. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scopeDescription.rb +75 -0
  99. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_securityConstraints.rb +97 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_series.rb +63 -0
  101. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +125 -0
  102. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_spatialRepresentation.rb +61 -0
  103. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_temporalExtent.rb +53 -0
  104. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timeInstant.rb +80 -0
  105. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timePeriod.rb +113 -0
  106. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_transferOptions.rb +107 -0
  107. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_unitsOfMeasure.rb +258 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_usage.rb +134 -0
  109. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_useConstraints.rb +41 -0
  110. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +61 -0
  111. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_verticalExtent.rb +70 -0
  112. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer.rb +105 -0
  113. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +132 -0
  114. data/lib/adiwg/mdtranslator/writers/iso19115_1/readme.md +12 -0
  115. data/lib/adiwg/mdtranslator/writers/iso19115_1/version.rb +15 -0
  116. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +3 -2
  117. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +42 -39
  118. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +2 -2
  119. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +3 -1
  120. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +12 -7
  121. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +2 -3
  122. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  123. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +1 -1
  124. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +42 -35
  125. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +4 -10
  126. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +1 -1
  127. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +5 -0
  128. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +2 -2
  129. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +1 -1
  130. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +7 -7
  131. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +0 -1
  132. data/lib/adiwg/mdtranslator_cli.rb +2 -1
  133. metadata +93 -5
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +0 -55
@@ -0,0 +1,134 @@
1
+ # ISO <<Class>> MD_Usage
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-25 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_timeInstant'
9
+ require_relative 'class_timePeriod'
10
+ require_relative 'class_responsibility'
11
+ require_relative 'class_citation'
12
+
13
+ module ADIWG
14
+ module Mdtranslator
15
+ module Writers
16
+ module Iso19115_1
17
+
18
+ class MD_Usage
19
+
20
+ def initialize(xml, hResponseObj)
21
+ @xml = xml
22
+ @hResponseObj = hResponseObj
23
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
24
+ end
25
+
26
+ def writeXML(hUsage)
27
+
28
+ # classes used in MD_Usage
29
+ instantClass = TimeInstant.new(@xml, @hResponseObj)
30
+ periodClass = TimePeriod.new(@xml, @hResponseObj)
31
+ responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
32
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
33
+
34
+ outContext = 'resource usage'
35
+
36
+ @xml.tag!('mri:MD_Usage') do
37
+
38
+ # usage - specific usage (required)
39
+ unless hUsage[:specificUsage].nil?
40
+ @xml.tag!('mri:specificUsage') do
41
+ @xml.tag!('gco:CharacterString', hUsage[:specificUsage])
42
+ end
43
+ end
44
+ if hUsage[:specificUsage].nil?
45
+ @NameSpace.issueWarning(320, 'mri:specificUsage')
46
+ end
47
+
48
+ # usage - dateTime [0] {TimeInstant | TimePeriod}
49
+ aExtents = hUsage[:temporalExtents]
50
+ aExtents.each do |hExtent|
51
+ unless hExtent.empty?
52
+ haveTime = false
53
+ unless hExtent[:timeInstant].empty?
54
+ @xml.tag!('mri:usageDateTime') do
55
+ instantClass.writeXML(hExtent[:timeInstant])
56
+ end
57
+ haveTime = true
58
+ end
59
+ unless hExtent[:timePeriod].empty?
60
+ @xml.tag!('mri:usageDateTime') do
61
+ periodClass.writeXML(hExtent[:timePeriod])
62
+ end
63
+ haveTime = true
64
+ end
65
+ if !haveTime
66
+ @NameSpace.issueWarning(410, 'mri:usageDateTime', outContext)
67
+ end
68
+ end
69
+ end
70
+ if aExtents.empty? && @hResponseObj[:writerShowTags]
71
+ @xml.tag!('mri:usageDateTime')
72
+ end
73
+
74
+ # usage - user determined limitations
75
+ unless hUsage[:userLimitation].nil?
76
+ @xml.tag!('mri:userDeterminedLimitations') do
77
+ @xml.tag!('gco:CharacterString', hUsage[:userLimitation])
78
+ end
79
+ end
80
+ if hUsage[:userLimitation].nil? && @hResponseObj[:writerShowTags]
81
+ @xml.tag!('mri:userDeterminedLimitations')
82
+ end
83
+
84
+ # usage - user contact info [] {CI_Responsibility}
85
+ aResponsibility = hUsage[:userContacts]
86
+ aResponsibility.each do |hResponsibility|
87
+ @xml.tag!('mri:userContactInfo') do
88
+ responsibilityClass.writeXML(hResponsibility, outContext)
89
+ end
90
+ end
91
+ if aResponsibility.empty? && @hResponseObj[:writerShowTags]
92
+ @xml.tag!('mri:userContactInfo')
93
+ end
94
+
95
+ # usage - response []
96
+ aResponses = hUsage[:limitationResponses]
97
+ aResponses.each do |hResponse|
98
+ @xml.tag!('mri:response') do
99
+ @xml.tag!('gco:CharacterString', hResponse)
100
+ end
101
+ end
102
+ if aResponses.empty? && @hResponseObj[:writerShowTags]
103
+ @xml.tag!('mri:response')
104
+ end
105
+
106
+ # usage - additional documentation [] {CI_Citation}
107
+ aDocuments = hUsage[:additionalDocumentation]
108
+ aDocuments.each do |hDocument|
109
+ @xml.tag!('mri:additionalDocumentation') do
110
+ citationClass.writeXML(hDocument, outContext)
111
+ end
112
+ end
113
+ if aDocuments.empty? && @hResponseObj[:writerShowTags]
114
+ @xml.tag!('mri:additionalDocumentation')
115
+ end
116
+
117
+ # usage - identification issues {CI_Citation}
118
+ unless hUsage[:identifiedIssue].empty?
119
+ @xml.tag!('mri:identifiedIssues') do
120
+ citationClass.writeXML(hUsage[:identifiedIssue], outContext)
121
+ end
122
+ end
123
+ if hUsage[:identifiedIssue].empty? && @hResponseObj[:writerShowTags]
124
+ @xml.tag!('mri:identifiedIssues')
125
+ end
126
+
127
+ end # mri:MD_Usage tag
128
+ end # writeXML
129
+ end # MD_Usage class
130
+
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,41 @@
1
+ # ISO <<Class>> MD_Constraints (Use Constraint)
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-18 original script
6
+
7
+ require_relative 'class_constraintCommon'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class MD_Constraints
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hConstraint, inContext = nil)
22
+
23
+ # classes used
24
+ commonClass = ConstraintCommon.new(@xml, @hResponseObj)
25
+
26
+ outContext = 'use constraint'
27
+ outContext = inContext + ' use constraint' unless inContext.nil?
28
+
29
+ @xml.tag!('mco:MD_Constraints') do
30
+ unless hConstraint.empty?
31
+ commonClass.writeXML(hConstraint, outContext)
32
+ end
33
+ end
34
+
35
+ end # writeXML
36
+ end # MD_Constraints class
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,61 @@
1
+ # ISO <<Class>> MD_VectorSpatialRepresentation
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-16 original script.
6
+
7
+ require_relative 'class_codelist'
8
+ require_relative 'class_geometricObjects'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_VectorSpatialRepresentation
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hVector, inContext = nil)
23
+
24
+ # classes used
25
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
+ geoObjClass = MD_GeometricObjects.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'vector representation'
29
+ outContext = inContext + ' vector representation' unless inContext.nil?
30
+
31
+ @xml.tag!('msr:MD_VectorSpatialRepresentation') do
32
+
33
+ # vector representation - topology level
34
+ unless hVector[:topologyLevel].nil?
35
+ @xml.tag!('msr:topologyLevel') do
36
+ codelistClass.writeXML('msr', 'iso_topologyLevel', hVector[:topologyLevel])
37
+ end
38
+ end
39
+ if hVector[:topologyLevel].nil? && @hResponseObj[:writerShowTags]
40
+ @xml.tag!('msr:topologyLevel')
41
+ end
42
+
43
+ # vector representation - geometric objects [{MD_GeometricObjects}]
44
+ aGeoObjs = hVector[:vectorObject]
45
+ aGeoObjs.each do |hGeoObj|
46
+ @xml.tag!('msr:geometricObjects') do
47
+ geoObjClass.writeXML(hGeoObj, outContext)
48
+ end
49
+ end
50
+ if aGeoObjs.empty? && @hResponseObj[:writerShowTags]
51
+ @xml.tag!('msr:geometricObjects')
52
+ end
53
+
54
+ end # msr:MD_VectorSpatialRepresentation tag
55
+ end # writeXML
56
+ end # MD_VectorSpatialRepresentation class
57
+
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,70 @@
1
+ # ISO <<Class>> EX_VerticalExtent
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-19 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_referenceSystem'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class EX_VerticalExtent
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
21
+ end
22
+
23
+ def writeXML(hVertEle)
24
+
25
+ # classes used
26
+ referenceClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
27
+
28
+ @xml.tag!('gex:EX_VerticalExtent') do
29
+
30
+ # vertical extent - minimum value (required)
31
+ unless hVertEle[:minValue].nil?
32
+ @xml.tag!('gex:minimumValue') do
33
+ @xml.tag!('gco:Real', hVertEle[:minValue])
34
+ end
35
+ end
36
+ if hVertEle[:minValue].nil?
37
+ @NameSpace.issueWarning(330, 'gex:minimumValue')
38
+ end
39
+
40
+ # vertical extent - maximum value (required)
41
+ unless hVertEle[:maxValue].nil?
42
+ @xml.tag!('gex:maximumValue') do
43
+ @xml.tag!('gco:Real', hVertEle[:maxValue])
44
+ end
45
+ end
46
+ if hVertEle[:maxValue].nil?
47
+ @NameSpace.issueWarning(331, 'gex:maximumValue')
48
+ end
49
+
50
+ # vertical extent - vertical crs ID {MD_ReferenceSystem}
51
+ unless hVertEle[:crsId].empty?
52
+ @xml.tag!('gex:verticalCRSId') do
53
+ referenceClass.writeXML(hVertEle[:crsId])
54
+ end
55
+ end
56
+ if hVertEle[:crsId].empty? && @hResponseObj[:writerShowTags]
57
+ @xml.tag!('gex:verticalCRSId')
58
+ end
59
+
60
+ # vertical extent - vertical crs {many possible classes}
61
+ # not implemented
62
+
63
+ end # EX_VerticalExtent tag
64
+ end # writeXML
65
+ end # EX_VerticalExtent class
66
+
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,105 @@
1
+ # Writer - internal data structure to ISO 19115-1:2014
2
+
3
+ # History:
4
+ # Stan Smith 2019-03-12 original script
5
+
6
+ # items not implemented in mdJson
7
+ # online resource - applicationProfile (string)
8
+ # online resource - protocol request (string)
9
+ # party - multiple contactInfo{}
10
+
11
+ require 'builder'
12
+ require 'adiwg/mdtranslator/writers/iso19115_1/version'
13
+ require 'adiwg/mdtranslator/internal/module_dateTimeFun'
14
+ require_relative 'classes/class_mdMetadata'
15
+
16
+ module ADIWG
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19115_1
20
+
21
+ def self.startWriter(intObj, hResponseObj)
22
+
23
+ # make contact available to the instance
24
+ @contacts = intObj[:contacts]
25
+ @hResponseObj = hResponseObj
26
+
27
+ # load error message array
28
+ file = File.join(File.dirname(__FILE__), 'iso19115_1_writer_messages_eng') + '.yml'
29
+ hMessageList = YAML.load_file(file)
30
+ @aMessagesList = hMessageList['messageList']
31
+
32
+ # set the format of the output file based on the writer specified
33
+ hResponseObj[:writerOutputFormat] = 'xml'
34
+ hResponseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Iso19115_1::VERSION
35
+
36
+ # create new XML document
37
+ @xml = Builder::XmlMarkup.new(indent: 3)
38
+
39
+ # start writing the ISO 19115-1 XML record
40
+ metadataWriter = MD_Metadata.new(@xml, hResponseObj)
41
+ metadata = metadataWriter.writeXML(intObj)
42
+
43
+ return metadata
44
+
45
+ end
46
+
47
+ # find contact in contact array and return the contact hash
48
+ def self.getContact(contactId)
49
+
50
+ @contacts.each do |hContact|
51
+ if hContact[:contactId] == contactId
52
+ return hContact
53
+ end
54
+ end
55
+ return {}
56
+
57
+ end
58
+
59
+ def self.findMessage(messageId)
60
+ @aMessagesList.each do |hMessage|
61
+ if hMessage['id'] == messageId
62
+ return hMessage['message']
63
+ end
64
+ end
65
+ return nil
66
+ end
67
+
68
+ def self.issueError(messageId, context = nil)
69
+ message = findMessage(messageId)
70
+ unless message.nil?
71
+ message += ': CONTEXT is ' + context unless context.nil?
72
+ @hResponseObj[:writerMessages] << 'ERROR: ISO-19115-1 writer: ' + message
73
+ @hResponseObj[:writerPass] = false
74
+ end
75
+ end
76
+
77
+ def self.issueWarning(messageId, tag = nil, context = nil)
78
+ message = findMessage(messageId)
79
+ unless message.nil?
80
+ message += ': CONTEXT is ' + context unless context.nil?
81
+ if @hResponseObj[:writerForceValid]
82
+ if tag.nil?
83
+ issueError(messageId, context)
84
+ else
85
+ @xml.tag!(tag, {'gco:nilReason' => 'missing'})
86
+ @hResponseObj[:writerMessages] << 'WARNING: ISO-19115-1 writer: ' + message
87
+ end
88
+ else
89
+ @hResponseObj[:writerMessages] << 'WARNING: ISO-19115-1 writer: ' + message
90
+ end
91
+ end
92
+ end
93
+
94
+ def self.issueNotice(messageId, context = nil)
95
+ message = findMessage(messageId)
96
+ unless message.nil?
97
+ message += ': CONTEXT is ' + context unless context.nil?
98
+ @hResponseObj[:writerMessages] << 'NOTICE: ISO-19115-1 writer: ' + message
99
+ end
100
+ end
101
+
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,132 @@
1
+ # Writer - messages for ISO 19115-1:2014
2
+
3
+ # History:
4
+ # Stan Smith 20189-03-12 original script
5
+
6
+ messageList:
7
+ - {id: 1, message: "associated resource association type is missing"}
8
+
9
+ - {id: 10, message: "bounding box west longitude is missing"}
10
+ - {id: 11, message: "bounding box east longitude is missing"}
11
+ - {id: 12, message: "bounding box south latitude is missing"}
12
+ - {id: 13, message: "bounding box north latitude is missing"}
13
+
14
+ - {id: 20, message: "browse graphic file name is missing"}
15
+
16
+ - {id: 30, message: "citation title is missing"}
17
+
18
+ - {id: 40, message: "coverage attribute description is missing"}
19
+ - {id: 41, message: "coverage content type is missing"}
20
+
21
+ - {id: 50, message: "resource citation is missing"}
22
+ - {id: 51, message: "resource abstract is missing"}
23
+ - {id: 52, message: "resource point of contact is missing"}
24
+ - {id: 53, message: "multiple taxonomies were provided, ISO 19115-2 allows only one"}
25
+ - {id: 54, message: "the first taxonomy was written to the metadata record"}
26
+
27
+ - {id: 60, message: "data quality scope is missing"}
28
+
29
+ - {id: 70, message: "date is missing"}
30
+ - {id: 71, message: "date type is missing"}
31
+
32
+ - {id: 80, message: "dimension type is missing"}
33
+ - {id: 81, message: "dimension size is missing"}
34
+
35
+ - {id: 90, message: "distributor contact is missing"}
36
+
37
+ - {id: 100, message: "extension extended element name is missing"}
38
+ - {id: 101, message: "extension extended element definition is missing"}
39
+ - {id: 102, message: "extension extended element entity type is missing"}
40
+ - {id: 103, message: "extension extended element parent entity is missing"}
41
+ - {id: 104, message: "extension extended element rule is missing"}
42
+ - {id: 105, message: "extension extended element source is missing"}
43
+
44
+ - {id: 110, message: "GeoJSON geometry object type is not recognized"}
45
+
46
+ - {id: 120, message: "format specification citation is missing"}
47
+ - {id: 121, message: "format version is missing"}
48
+
49
+ - {id: 130, message: "spatial resolution representative fraction denominator is missing"}
50
+
51
+ - {id: 140, message: "GeoJSON geometry is not supported by feature"}
52
+
53
+ - {id: 150, message: "vector object type is missing"}
54
+
55
+ - {id: 160, message: "GeoJSON geometry is not supported by geometry collection"}
56
+ - {id: 161, message: "Geometry collection has no geometries"}
57
+
58
+ - {id: 170, message: "georectified corner points are missing"}
59
+ - {id: 171, message: "georectified point in pixel is missing"}
60
+ - {id: 172, message: "georectified must have either 2 or 4 corner points"}
61
+
62
+ - {id: 180, message: "georeferenced parameter is missing"}
63
+
64
+ - {id: 190, message: "grid representation number of dimensions is missing"}
65
+ - {id: 191, message: "grid representation dimensions are missing"}
66
+ - {id: 192, message: "grid representation cell geometry is missing"}
67
+
68
+ - {id: 200, message: "keyword section keywords are missing"}
69
+
70
+ - {id: 210, message: "locale language code is missing"}
71
+ - {id: 211, message: "locale character encoding is missing"}
72
+
73
+ - {id: 220, message: "maintenance update frequency is missing"}
74
+
75
+ - {id: 230, message: "identifier code is missing"}
76
+
77
+ - {id: 240, message: "metadata contacts are missing"}
78
+ - {id: 241, message: "data identification section (resourceInfo) is missing"}
79
+
80
+ - {id: 250, message: "online resource URL is missing"}
81
+
82
+ - {id: 260, message: "process step description is missing"}
83
+
84
+ - {id: 270, message: "responsible party role is missing"}
85
+ - {id: 271, message: "responsible party is missing"}
86
+ - {id: 272, message: "responsible party not found"}
87
+ - {id: 273, message: "responsible party logo is missing"}
88
+ - {id: 274, message: "responsible party organization member not found"}
89
+
90
+ - {id: 280, message: "scope level (code) is missing"}
91
+
92
+ - {id: 290, message: "security constraint classification is missing"}
93
+ - {id: 291, message: "legal constraint is missing when constraint type is 'legal'"}
94
+ - {id: 292, message: "security constraint is missing when constraint type is 'security'"}
95
+ - {id: 293, message: "constraint type must be 'use', 'legal' or 'security'"}
96
+
97
+ - {id: 300, message: "taxonomic level is missing"}
98
+ - {id: 301, message: "taxonomic name is missing"}
99
+
100
+ - {id: 310, message: "taxonomic classification system is missing"}
101
+ - {id: 311, message: "taxonomic identification reference is missing"}
102
+ - {id: 312, message: "taxonomic observer is missing"}
103
+ - {id: 313, message: "taxonomic procedures are missing"}
104
+ - {id: 314, message: "taxonomic classification is missing"}
105
+ - {id: 315, message: "multiple taxonomic classifications were specified, ISO 19115-2 supports only one"}
106
+ - {id: 316, message: "the first taxonomic classification was written to the metadata record"}
107
+
108
+ - {id: 320, message: "resource specific usage is missing"}
109
+ - {id: 321, message: "resource specific usage contact is missing"}
110
+
111
+ - {id: 330, message: "vertical extent minimum is missing"}
112
+ - {id: 331, message: "vertical extent maximum is missing"}
113
+ - {id: 332, message: "vertical extent coordinate reference system is missing"}
114
+
115
+ - {id: 340, message: "taxonomic voucher specimen is missing"}
116
+ - {id: 341, message: "taxonomic voucher repository is missing"}
117
+
118
+ - {id: 350, message: "attribute sequence identifier is missing"}
119
+ - {id: 351, message: "attribute sequence identifier type is missing"}
120
+
121
+ - {id: 360, message: "measure type is invalid; must be one of [distance, length, angle, measure, scale]"}
122
+
123
+ - {id: 370, message: "phone number is missing"}
124
+
125
+ - {id: 380, message: "spatial reference system identifier is missing"}
126
+ - {id: 381, message: "spatial reference system type is missing"}
127
+
128
+ - {id: 390, message: "resource type 'type' is missing"}
129
+
130
+ - {id: 400, message: "invalid topic category"}
131
+
132
+ - {id: 410, message: "temporal extent must have a TimeInstant or TimePeriod"}