adiwg-mdtranslator 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
  5. data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
  13. data/lib/adiwg/mdtranslator/version.rb +5 -1
  14. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
  16. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
  22. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
  23. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
  24. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
  25. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
  26. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
  27. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
  28. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
  29. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
  30. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
  31. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
  32. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
  33. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
  34. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
  35. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
  36. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
  37. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
  38. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
  39. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
  40. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
  41. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
  47. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
  48. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
  49. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
  50. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
  51. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
  52. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
  53. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
  54. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
  55. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
  56. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
  57. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
  58. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
  59. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
  60. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
  61. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
  62. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
  63. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
  64. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
  65. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
  66. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
  67. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
  68. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
  69. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
  70. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
  71. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
  72. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
  73. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
  74. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
  75. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
  76. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
  77. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
  78. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
  82. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
  83. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  84. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
  85. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
  86. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
  87. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
  88. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
  89. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
  90. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
  91. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
  92. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
  93. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
  94. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
  95. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
  96. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
  97. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
  98. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
  99. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
  100. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
  101. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
  102. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
  103. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
  104. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
  105. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
  106. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
  107. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
  109. data/lib/adiwg/mdtranslator_cli.rb +21 -4
  110. metadata +6 -5
@@ -5,60 +5,60 @@
5
5
  # Stan Smith 2015-08-27 copied from 19110 writer
6
6
 
7
7
  module ADIWG
8
- module Mdtranslator
9
- module Writers
10
- module Iso19115_2
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_2
11
11
 
12
- class ConventionalUnit
12
+ class ConventionalUnit
13
13
 
14
- def initialize(xml, hResponseObj)
15
- @xml = xml
16
- @hResponseObj = hResponseObj
17
- end
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
18
 
19
- def writeXML(hConv)
19
+ def writeXML(hConv)
20
20
 
21
- # create and identity for the unit
22
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
23
- unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
21
+ # create and identity for the unit
22
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
23
+ unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
24
24
 
25
- @xml.tag!('gml:ConventionalUnit', {'gml:id' => unitID}) do
26
- @xml.tag!('gml:identifier', {'codeSpace' => hConv[:codeSpace]}, hConv[:identifier])
27
- @xml.tag!('gml:name', hConv[:name])
28
- @xml.tag!('gml:catalogSymbol', hConv[:catalogSymbol])
29
- @xml.tag!('gml:conversionToPreferredUnit', {'uom' => hConv[:preferredUnit]}) do
25
+ @xml.tag!('gml:ConventionalUnit', {'gml:id' => unitID}) do
26
+ @xml.tag!('gml:identifier', {'codeSpace' => hConv[:codeSpace]}, hConv[:identifier])
27
+ @xml.tag!('gml:name', hConv[:name])
28
+ @xml.tag!('gml:catalogSymbol', hConv[:catalogSymbol])
29
+ @xml.tag!('gml:conversionToPreferredUnit', {'uom' => hConv[:preferredUnit]}) do
30
30
 
31
- # two methods of conversion are available
32
- # factor and formula
33
- if !hConv[:factor].nil?
34
- # factor:
35
- # y = factor * x
36
- # y is in preferred units
37
- # x is in provided units
38
- # factor is conversion to preferred units
39
- @xml.tag!('gml:factor', hConv[:factor])
40
- else
41
- # formula:
42
- # y = (a + bx) / (c + dx)
43
- # y is in preferred units
44
- # x is in provided units
45
- # a,b,c,d are constants to convert to preferred units
46
- @xml.tag!('gml:formula') do
47
- @xml.tag!('gml:a', hConv[:a])
48
- @xml.tag!('gml:b', hConv[:b])
49
- @xml.tag!('gml:c', hConv[:c])
50
- @xml.tag!('gml:d', hConv[:d])
51
- end
52
- end
53
-
54
- end
31
+ # two methods of conversion are available
32
+ # factor and formula
33
+ if !hConv[:factor].nil?
34
+ # factor:
35
+ # y = factor * x
36
+ # y is in preferred units
37
+ # x is in provided units
38
+ # factor is conversion to preferred units
39
+ @xml.tag!('gml:factor', hConv[:factor])
40
+ else
41
+ # formula:
42
+ # y = (a + bx) / (c + dx)
43
+ # y is in preferred units
44
+ # x is in provided units
45
+ # a,b,c,d are constants to convert to preferred units
46
+ @xml.tag!('gml:formula') do
47
+ @xml.tag!('gml:a', hConv[:a])
48
+ @xml.tag!('gml:b', hConv[:b])
49
+ @xml.tag!('gml:c', hConv[:c])
50
+ @xml.tag!('gml:d', hConv[:d])
51
+ end
55
52
  end
56
53
 
57
- end
54
+ end
55
+ end
58
56
 
59
- end
57
+ end
60
58
 
61
59
  end
62
- end
63
- end
60
+
61
+ end
62
+ end
63
+ end
64
64
  end
@@ -2,98 +2,125 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-23 refactored for mdTranslator/mdJson 2.0
5
+ # Stan Smith 2018-04-09 add error and warning messaging
6
+ # Stan Smith 2016-11-23 refactored for mdTranslator/mdJson 2.0
6
7
  # Stan Smith 2015-08-27 original script.
7
8
 
9
+ require_relative '../iso19115_2_writer'
8
10
  require_relative 'class_codelist'
9
- require_relative 'class_attributeGroup'
11
+ require_relative 'class_attribute'
10
12
  require_relative 'class_image'
11
13
 
12
14
  module ADIWG
13
- module Mdtranslator
14
- module Writers
15
- module Iso19115_2
15
+ module Mdtranslator
16
+ module Writers
17
+ module Iso19115_2
16
18
 
17
- class CoverageDescription
19
+ class CoverageDescription
18
20
 
19
- def initialize(xml, hResponseObj)
20
- @xml = xml
21
- @hResponseObj = hResponseObj
22
- end
21
+ def initialize(xml, hResponseObj)
22
+ @xml = xml
23
+ @hResponseObj = hResponseObj
24
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
25
+ end
26
+
27
+ def writeXML(hCoverage)
23
28
 
24
- def writeXML(hCoverage)
29
+ # classes used
30
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
31
+ attributeClass = Attribute.new(@xml, @hResponseObj)
32
+ imageClass = MI_ImageDescription.new(@xml, @hResponseObj)
25
33
 
26
- # classes used
27
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
28
- attGroupClass = AttributeGroup.new(@xml, @hResponseObj)
29
- imageClass = MI_ImageDescription.new(@xml, @hResponseObj)
34
+ # determine type of MD_CoverageDescription to write
35
+ if hCoverage[:imageDescription].empty?
36
+ contentTag = 'gmi:MI_CoverageDescription'
37
+ else
38
+ contentTag = 'gmi:MI_ImageDescription'
39
+ end
30
40
 
31
- # determine type of MD_CoverageDescription to write
32
- if hCoverage[:imageDescription].empty?
33
- contentTag = 'gmi:MI_CoverageDescription'
34
- else
35
- contentTag = 'gmi:MI_ImageDescription'
36
- end
37
-
38
- @xml.tag!(contentTag) do
41
+ @xml.tag!(contentTag) do
39
42
 
40
- # coverage description - attribute description (required)
41
- # combine coverageName and coverageDescription
42
- attDesc = ''
43
- unless hCoverage[:coverageName].nil?
44
- attDesc += hCoverage[:coverageName] + '; '
45
- end
46
- unless hCoverage[:coverageDescription].nil?
47
- attDesc += hCoverage[:coverageDescription]
48
- end
49
- unless attDesc == ''
50
- @xml.tag!('gmd:attributeDescription') do
51
- @xml.tag!('gco:RecordType', attDesc)
52
- end
53
- end
54
- if attDesc == ''
55
- @xml.tag!('gmd:attributeDescription', {'gco:nilReason'=>'missing'})
56
- end
43
+ # coverage description - attribute description (required)
44
+ # combine coverageName and coverageDescription
45
+ attDesc = ''
46
+ unless hCoverage[:coverageName].nil?
47
+ attDesc += hCoverage[:coverageName] + '; '
48
+ end
49
+ unless hCoverage[:coverageDescription].nil?
50
+ attDesc += hCoverage[:coverageDescription]
51
+ end
52
+ unless attDesc == ''
53
+ @xml.tag!('gmd:attributeDescription') do
54
+ @xml.tag!('gco:RecordType', attDesc)
55
+ end
56
+ end
57
+ if attDesc == ''
58
+ @NameSpace.issueWarning(40, 'gmd:attributeDescription')
59
+ end
57
60
 
58
- # coverage description - content type (required) {MD_CoverageContentTypeCode}
59
- aGroups = hCoverage[:attributeGroups]
60
- s = nil
61
- unless aGroups.empty?
62
- s = aGroups[0][:attributeContentTypes][0]
63
- unless s.nil?
64
- @xml.tag!('gmd:contentType') do
65
- codelistClass.writeXML('gmd', 'iso_coverageContentType',s)
66
- end
67
- end
68
- end
69
- if s.nil?
70
- @xml.tag!('gmd:contentType', {'gco:nilReason'=>'missing'})
71
- end
61
+ # coverage description - content type (required) {MD_CoverageContentTypeCode}
62
+ # coverageContentTypeCode (ISO) = attributeContentType (mdJson)
63
+ # in ISO 19115-1 coverageContentTypeCode [] (required) in attributeGroup
64
+ # ... coverageContentTypeCode applies only to attributeGroup
65
+ # in ISO 19115-2 coverageContentTypeCode (required) in CoverageDescription
66
+ # ... contentInfo must be either coverageDescription or imageDescription
67
+ # ... coverageContentTypeCode applies to both imageDescription and attribute (rangeDimension)
68
+ # mdJson does not require either attributeGroup or imageDescription
69
+ # so, coverageContentTypeCode will be missing when content info is imageDescription
70
+ # how to handle in ISO 19115-2 ...
71
+ # when content info is imageDescription set contentCoverageType to 'image'
72
+ # when content info is attributeGroup contentCoverageType will be available
73
+ # when content info is not provided set contentType to 'nilReason=missing'
74
+ contentType = nil
75
+ contentType = 'image' if contentTag == 'gmi:MI_ImageDescription'
76
+ if contentTag == 'gmi:MI_CoverageDescription'
77
+ aGroups = hCoverage[:attributeGroups]
78
+ unless aGroups.empty?
79
+ aAttContents = aGroups[0][:attributeContentTypes]
80
+ unless aAttContents.empty?
81
+ contentType = aAttContents[0]
82
+ end
83
+ end
84
+ end
85
+ unless contentType.nil?
86
+ @xml.tag!('gmd:contentType') do
87
+ codelistClass.writeXML('gmd', 'iso_coverageContentType', contentType)
88
+ end
89
+ end
90
+ if contentType.nil?
91
+ @NameSpace.issueWarning(41, 'gmd:contentType')
92
+ end
72
93
 
73
- # coverage description - dimension []
74
- aGroups.each do |hGroup|
75
- aAttributes = hGroup[:attributes]
76
- aAttributes.each do |hAttributes|
77
- @xml.tag!('gmd:dimension') do
78
- attGroupClass.writeXML(hAttributes)
79
- end
80
- end
81
- end
82
- if aGroups.empty? && @hResponseObj[:writerShowTags]
83
- @xml.tag!('gmd:dimension')
84
- end
94
+ # coverage description - dimension []
95
+ haveAttribute = false
96
+ if contentTag == 'gmi:MI_CoverageDescription'
97
+ aGroups.each do |hGroup|
98
+ aAttributes = hGroup[:attributes]
99
+ aAttributes.each do |hAttribute|
100
+ @xml.tag!('gmd:dimension') do
101
+ attributeClass.writeXML(hAttribute)
102
+ haveAttribute = true
103
+ end
104
+ end
105
+ end
106
+ if !haveAttribute && @hResponseObj[:writerShowTags]
107
+ @xml.tag!('gmd:dimension')
108
+ end
109
+ end
85
110
 
86
- # coverage description - image information
87
- hImage = hCoverage[:imageDescription]
88
- unless hImage.empty?
89
- imageClass.writeXML(hCoverage)
90
- end
111
+ # coverage description - image information
112
+ if contentTag == 'gmi:MI_ImageDescription'
113
+ hImage = hCoverage[:imageDescription]
114
+ unless hImage.empty?
115
+ imageClass.writeXML(hCoverage)
116
+ end
117
+ end
91
118
 
92
- end # MI_CoverageDescription/MI_ImageDescription tag
93
- end # writeXML
94
- end # ContentInformation class
119
+ end # MI_CoverageDescription/MI_ImageDescription tag
120
+ end # writeXML
121
+ end # ContentInformation class
95
122
 
96
- end
97
- end
98
- end
123
+ end
124
+ end
125
+ end
99
126
  end
@@ -33,7 +33,7 @@ module ADIWG
33
33
  hIdentifier = hParamSet[:projection][:projectionIdentifier]
34
34
  unless hIdentifier.empty?
35
35
  @xml.tag!('gmd:projection') do
36
- idClass.writeXML(hIdentifier)
36
+ idClass.writeXML(hIdentifier, 'CRS projection')
37
37
  end
38
38
  end
39
39
  end
@@ -46,7 +46,7 @@ module ADIWG
46
46
  hIdentifier = hParamSet[:geodetic][:ellipsoidIdentifier]
47
47
  unless hIdentifier.empty?
48
48
  @xml.tag!('gmd:ellipsoid') do
49
- idClass.writeXML(hIdentifier)
49
+ idClass.writeXML(hIdentifier, 'CRS geodetic ellipsoid')
50
50
  end
51
51
  end
52
52
  end
@@ -60,7 +60,7 @@ module ADIWG
60
60
  hIdentifier = hParamSet[:geodetic][:datumIdentifier]
61
61
  unless hIdentifier.empty?
62
62
  @xml.tag!('gmd:datum') do
63
- idClass.writeXML(hIdentifier)
63
+ idClass.writeXML(hIdentifier, 'CRS geodetic datum')
64
64
  haveDatum = true
65
65
  end
66
66
  end
@@ -71,7 +71,7 @@ module ADIWG
71
71
  hIdentifier = hParamSet[:verticalDatum][:datumIdentifier]
72
72
  unless hIdentifier.empty?
73
73
  @xml.tag!('gmd:datum') do
74
- idClass.writeXML(hIdentifier)
74
+ idClass.writeXML(hIdentifier, 'CRS vertical datum')
75
75
  haveDatum = true
76
76
  end
77
77
  end
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-09 add error and warning messaging
5
6
  # Stan Smith 2018-04-06 changed taxonomy to an array
6
7
  # Stan Smith 2018-01-05 deprecated topicCategory[]
7
8
  # Stan Smith 2018-01-05 get topics from keywords where type='isoTopicCategory'
@@ -14,7 +15,7 @@
14
15
  # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
15
16
  # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
16
17
  # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
17
- # Stan Smith 2014-10-29 add resource time period as a extent temporal element
18
+ # Stan Smith 2014-10-29 add resource time period as a temporalExtent element
18
19
  # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
19
20
  # Stan Smith 2014-05-21 added aggregate information section
20
21
  # Stan Smith 2014-05-15 modify to support JSON schema version 0.4.0
@@ -27,6 +28,8 @@
27
28
  # Stan Smith 2013-09-18 add descriptive keywords
28
29
  # Stan Smith 2013-08-26 original script
29
30
 
31
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
32
+ require_relative '../iso19115_2_writer'
30
33
  require_relative 'class_codelist'
31
34
  require_relative 'class_enumerationList'
32
35
  require_relative 'class_citation'
@@ -54,11 +57,13 @@ module ADIWG
54
57
  def initialize(xml, hResponseObj)
55
58
  @xml = xml
56
59
  @hResponseObj = hResponseObj
60
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
57
61
  end
58
62
 
59
63
  def writeXML(hData, aAssocRes, aDistInfo)
60
64
 
61
65
  # classes used
66
+ intMetadataClass = InternalMetadata.new
62
67
  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
63
68
  enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
64
69
  citationClass = CI_Citation.new(@xml, @hResponseObj)
@@ -83,11 +88,11 @@ module ADIWG
83
88
  hCitation = hData[:citation]
84
89
  unless hCitation.empty?
85
90
  @xml.tag!('gmd:citation') do
86
- citationClass.writeXML(hCitation)
91
+ citationClass.writeXML(hCitation, 'main resource citation')
87
92
  end
88
93
  end
89
94
  if hCitation.empty?
90
- @xml.tag!('gmd:citation', {'gco:nilReason' => 'missing'})
95
+ @NameSpace.issueWarning(50, 'gmd:citation')
91
96
  end
92
97
 
93
98
  # data identification - abstract (required)
@@ -98,7 +103,7 @@ module ADIWG
98
103
  end
99
104
  end
100
105
  if s.nil?
101
- @xml.tag!('gmd:abstract', {'gco:nilReason' => 'missing'})
106
+ @NameSpace.issueWarning(51, 'gmd:abstract')
102
107
  end
103
108
 
104
109
  # data identification - purpose
@@ -112,6 +117,16 @@ module ADIWG
112
117
  @xml.tag!('gmd:purpose')
113
118
  end
114
119
 
120
+ # data identification - time period {timePeriod}
121
+ # package as a temporal extent
122
+ unless hData[:timePeriod].empty?
123
+ hExtent = intMetadataClass.newExtent
124
+ hTempExtent = intMetadataClass.newTemporalExtent
125
+ hTempExtent[:timePeriod] = hData[:timePeriod]
126
+ hExtent[:temporalExtents] << hTempExtent
127
+ hData[:extents] << hExtent
128
+ end
129
+
115
130
  # data identification - credit []
116
131
  aCredits = hData[:credits]
117
132
  aCredits.each do |credit|
@@ -141,19 +156,19 @@ module ADIWG
141
156
  aParties = hRParty[:parties]
142
157
  aParties.each do |hParty|
143
158
  @xml.tag!('gmd:pointOfContact') do
144
- rPartyClass.writeXML(role, hParty)
159
+ rPartyClass.writeXML(role, hParty, 'data resource point of contact')
145
160
  end
146
161
  end
147
162
  end
148
163
  if aRParties.empty? && @hResponseObj[:writerShowTags]
149
- @xml.tag!('gmd:pointOfContact', {'gco:nilReason' => 'missing'})
164
+ @NameSpace.issueWarning(52, 'gmd:pointOfContact')
150
165
  end
151
166
 
152
167
  # data identification - resource maintenance []
153
168
  aMaint = hData[:resourceMaintenance]
154
169
  aMaint.each do |hMaint|
155
170
  @xml.tag!('gmd:resourceMaintenance') do
156
- mInfoClass.writeXML(hMaint)
171
+ mInfoClass.writeXML(hMaint, 'data resource')
157
172
  end
158
173
  end
159
174
  if aMaint.empty? && @hResponseObj[:writerShowTags]
@@ -164,7 +179,7 @@ module ADIWG
164
179
  aGraphics = hData[:graphicOverviews]
165
180
  aGraphics.each do |hGraphic|
166
181
  @xml.tag!('gmd:graphicOverview') do
167
- bGraphicClass.writeXML(hGraphic)
182
+ bGraphicClass.writeXML(hGraphic, 'data resource')
168
183
  end
169
184
  end
170
185
  if aGraphics.empty? && @hResponseObj[:writerShowTags]