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
@@ -2,115 +2,118 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-12 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
9
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
10
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
5
+ # Stan Smith 2018-04-10 add error and warning messaging
6
+ # Stan Smith 2016-12-12 refactored for mdTranslator/mdJson 2.0
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 2014-12-12 refactored to handle namespacing readers and writers
11
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
11
12
  # Stan Smith 2013-11-19 original script.
12
13
 
14
+ require_relative '../iso19115_2_writer'
13
15
  require_relative 'class_responsibleParty'
14
16
 
15
17
  module ADIWG
16
- module Mdtranslator
17
- module Writers
18
- module Iso19115_2
18
+ module Mdtranslator
19
+ module Writers
20
+ module Iso19115_2
19
21
 
20
- class MD_Usage
22
+ class MD_Usage
21
23
 
22
- def initialize(xml, hResponseObj)
23
- @xml = xml
24
- @hResponseObj = hResponseObj
25
- end
24
+ def initialize(xml, hResponseObj)
25
+ @xml = xml
26
+ @hResponseObj = hResponseObj
27
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
28
+ end
26
29
 
27
- def writeXML(hUsage)
30
+ def writeXML(hUsage)
28
31
 
29
- # classes used in MD_Usage
30
- partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
32
+ # classes used in MD_Usage
33
+ partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
31
34
 
32
- @xml.tag!('gmd:MD_Usage') do
35
+ @xml.tag!('gmd:MD_Usage') do
33
36
 
34
- # usage - specific usage (required)
35
- s = hUsage[:specificUsage]
36
- unless s.nil?
37
- @xml.tag!('gmd:specificUsage') do
38
- @xml.tag!('gco:CharacterString', s)
39
- end
40
- end
41
- if s.nil?
42
- @xml.tag!('gmd:specificUsage', {'gco:nilReason' => 'missing'})
43
- end
37
+ # usage - specific usage (required)
38
+ s = hUsage[:specificUsage]
39
+ unless s.nil?
40
+ @xml.tag!('gmd:specificUsage') do
41
+ @xml.tag!('gco:CharacterString', s)
42
+ end
43
+ end
44
+ if s.nil?
45
+ @NameSpace.issueWarning(320, 'gmd:specificUsage')
46
+ end
44
47
 
45
- # usage - dateTime [0]
46
- aTimes = hUsage[:temporalExtents]
47
- dateStr = nil
48
- unless aTimes.empty?
49
- hTime = aTimes[0]
50
- unless hTime.empty?
51
- hInstant = hTime[:timeInstant]
52
- hPeriod = hTime[:timePeriod]
53
- unless hInstant.empty?
54
- hDateTime = hInstant[:timeInstant]
55
- timeInstant = hDateTime[:dateTime]
56
- timeResolution = hDateTime[:dateResolution]
57
- dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant, timeResolution)
58
- hPeriod = {}
59
- end
60
- unless hPeriod.empty?
61
- hStart = hPeriod[:startDateTime]
62
- hEnd = hPeriod[:endDateTime]
63
- if !hStart.empty?
64
- dateTime = hStart[:dateTime]
65
- timeResolution = hStart[:dateResolution]
66
- else
67
- dateTime = hEnd[:dateTime]
68
- timeResolution = hEnd[:dateResolution]
69
- end
70
- dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
71
- end
72
- end
73
- end
74
- unless dateStr.nil?
75
- @xml.tag!('gmd:usageDateTime') do
76
- @xml.tag!('gco:DateTime', dateStr)
77
- end
78
- end
79
- if dateStr.nil? && @hResponseObj[:writerShowTags]
80
- @xml.tag!('gmd:usageDateTime')
81
- end
48
+ # usage - dateTime [0]
49
+ aTimes = hUsage[:temporalExtents]
50
+ dateStr = nil
51
+ unless aTimes.empty?
52
+ hTime = aTimes[0]
53
+ unless hTime.empty?
54
+ hInstant = hTime[:timeInstant]
55
+ hPeriod = hTime[:timePeriod]
56
+ unless hInstant.empty?
57
+ hDateTime = hInstant[:timeInstant]
58
+ timeInstant = hDateTime[:dateTime]
59
+ timeResolution = hDateTime[:dateResolution]
60
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant, timeResolution)
61
+ hPeriod = {}
62
+ end
63
+ unless hPeriod.empty?
64
+ hStart = hPeriod[:startDateTime]
65
+ hEnd = hPeriod[:endDateTime]
66
+ if !hStart.empty?
67
+ dateTime = hStart[:dateTime]
68
+ timeResolution = hStart[:dateResolution]
69
+ else
70
+ dateTime = hEnd[:dateTime]
71
+ timeResolution = hEnd[:dateResolution]
72
+ end
73
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
74
+ end
75
+ end
76
+ end
77
+ unless dateStr.nil?
78
+ @xml.tag!('gmd:usageDateTime') do
79
+ @xml.tag!('gco:DateTime', dateStr)
80
+ end
81
+ end
82
+ if dateStr.nil? && @hResponseObj[:writerShowTags]
83
+ @xml.tag!('gmd:usageDateTime')
84
+ end
82
85
 
83
- # usage - user determined limitations
84
- s = hUsage[:userLimitation]
85
- unless s.nil?
86
- @xml.tag!('gmd:userDeterminedLimitations') do
87
- @xml.tag!('gco:CharacterString', s)
88
- end
89
- end
90
- if s.nil? && @hResponseObj[:writerShowTags]
91
- @xml.tag!('gmd:userDeterminedLimitations')
92
- end
86
+ # usage - user determined limitations
87
+ s = hUsage[:userLimitation]
88
+ unless s.nil?
89
+ @xml.tag!('gmd:userDeterminedLimitations') do
90
+ @xml.tag!('gco:CharacterString', s)
91
+ end
92
+ end
93
+ if s.nil? && @hResponseObj[:writerShowTags]
94
+ @xml.tag!('gmd:userDeterminedLimitations')
95
+ end
93
96
 
94
- # usage - user contact info (required (optional -1)) [{CI_ResponsibleParty}]
95
- aParties = hUsage[:userContacts]
96
- aParties.each do |hRParty|
97
- role = hRParty[:roleName]
98
- aParties = hRParty[:parties]
99
- aParties.each do |hParty|
100
- @xml.tag!('gmd:userContactInfo') do
101
- partyClass.writeXML(role, hParty)
102
- end
103
- end
104
- end
105
- if aParties.empty?
106
- @xml.tag!('gmd:userContactInfo', {'gco:nilReason' => 'missing'})
107
- end
97
+ # usage - user contact info (required (optional -1)) [{CI_ResponsibleParty}]
98
+ aParties = hUsage[:userContacts]
99
+ aParties.each do |hRParty|
100
+ role = hRParty[:roleName]
101
+ aParties = hRParty[:parties]
102
+ aParties.each do |hParty|
103
+ @xml.tag!('gmd:userContactInfo') do
104
+ partyClass.writeXML(role, hParty, 'resource specific usage')
105
+ end
106
+ end
107
+ end
108
+ if aParties.empty?
109
+ @NameSpace.issueWarning(321, 'gmd:userContactInfo')
110
+ end
108
111
 
109
- end # gmd:MD_Usage tag
110
- end # writeXML
111
- end # MD_Usage class
112
+ end # gmd:MD_Usage tag
113
+ end # writeXML
114
+ end # MD_Usage class
112
115
 
113
- end
114
- end
115
- end
116
+ end
117
+ end
118
+ end
116
119
  end
@@ -2,45 +2,45 @@
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-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
9
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
5
+ # Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
6
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
9
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
10
10
  # Stan Smith 2013-10-31 original script
11
11
 
12
12
  module ADIWG
13
- module Mdtranslator
14
- module Writers
15
- module Iso19115_2
16
-
17
- class MD_Constraints
18
-
19
- def initialize(xml, hResponseObj)
20
- @xml = xml
21
- @hResponseObj = hResponseObj
22
- end
23
-
24
- def writeXML(hConstraint)
25
-
26
- @xml.tag!('gmd:MD_Constraints') do
27
-
28
- # use constraints - use limitation []
29
- aCons = hConstraint[:useLimitation]
30
- aCons.each do |useCon|
31
- @xml.tag!('gmd:useLimitation') do
32
- @xml.tag!('gco:CharacterString', useCon)
33
- end
34
- end
35
- if aCons.empty?
36
- @xml.tag!('gmd:useLimitation')
37
- end
38
-
39
- end # gmd:MD_Constraints tag
40
- end # writeXML
41
- end # MD_Constraints class
42
-
43
- end
44
- end
45
- end
13
+ module Mdtranslator
14
+ module Writers
15
+ module Iso19115_2
16
+
17
+ class MD_Constraints
18
+
19
+ def initialize(xml, hResponseObj)
20
+ @xml = xml
21
+ @hResponseObj = hResponseObj
22
+ end
23
+
24
+ def writeXML(hConstraint)
25
+
26
+ @xml.tag!('gmd:MD_Constraints') do
27
+
28
+ # use constraints - use limitation []
29
+ aCons = hConstraint[:useLimitation]
30
+ aCons.each do |useCon|
31
+ @xml.tag!('gmd:useLimitation') do
32
+ @xml.tag!('gco:CharacterString', useCon)
33
+ end
34
+ end
35
+ if aCons.empty?
36
+ @xml.tag!('gmd:useLimitation')
37
+ end
38
+
39
+ end # gmd:MD_Constraints tag
40
+ end # writeXML
41
+ end # MD_Constraints class
42
+
43
+ end
44
+ end
45
+ end
46
46
  end
@@ -8,52 +8,52 @@ require_relative 'class_codelist'
8
8
  require_relative 'class_geometricObjects'
9
9
 
10
10
  module ADIWG
11
- module Mdtranslator
12
- module Writers
13
- module Iso19115_2
14
-
15
- class MD_VectorSpatialRepresentation
16
-
17
- def initialize(xml, hResponseObj)
18
- @xml = xml
19
- @hResponseObj = hResponseObj
20
- end
21
-
22
- def writeXML(hVector)
23
-
24
- # classes used
25
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
- geoObjClass = MD_GeometricObjects.new(@xml, @hResponseObj)
27
-
28
- @xml.tag!('gmd:MD_VectorSpatialRepresentation') do
29
-
30
- # vector representation - topology level
31
- s = hVector[:topologyLevel]
32
- unless s.nil?
33
- @xml.tag!('gmd:topologyLevel') do
34
- codelistClass.writeXML('gmd', 'iso_topologyLevel', s)
35
- end
36
- end
37
- if s.nil? && @hResponseObj[:writerShowTags]
38
- @xml.tag!('gmd:topologyLevel')
39
- end
40
-
41
- # vector representation - geometric objects [{MD_GeometricObjects}]
42
- aGeoObjs = hVector[:vectorObject]
43
- aGeoObjs.each do |hGeoObj|
44
- @xml.tag!('gmd:geometricObjects') do
45
- geoObjClass.writeXML(hGeoObj)
46
- end
47
- end
48
- if aGeoObjs.empty? && @hResponseObj[:writerShowTags]
49
- @xml.tag!('gmd:geometricObjects')
50
- end
51
-
52
- end # gmd:MD_VectorSpatialRepresentation tag
53
- end # writeXML
54
- end # MD_VectorSpatialRepresentation class
55
-
56
- end
57
- end
58
- end
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_2
14
+
15
+ class MD_VectorSpatialRepresentation
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hVector)
23
+
24
+ # classes used
25
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
+ geoObjClass = MD_GeometricObjects.new(@xml, @hResponseObj)
27
+
28
+ @xml.tag!('gmd:MD_VectorSpatialRepresentation') do
29
+
30
+ # vector representation - topology level
31
+ s = hVector[:topologyLevel]
32
+ unless s.nil?
33
+ @xml.tag!('gmd:topologyLevel') do
34
+ codelistClass.writeXML('gmd', 'iso_topologyLevel', s)
35
+ end
36
+ end
37
+ if s.nil? && @hResponseObj[:writerShowTags]
38
+ @xml.tag!('gmd:topologyLevel')
39
+ end
40
+
41
+ # vector representation - geometric objects [{MD_GeometricObjects}]
42
+ aGeoObjs = hVector[:vectorObject]
43
+ aGeoObjs.each do |hGeoObj|
44
+ @xml.tag!('gmd:geometricObjects') do
45
+ geoObjClass.writeXML(hGeoObj)
46
+ end
47
+ end
48
+ if aGeoObjs.empty? && @hResponseObj[:writerShowTags]
49
+ @xml.tag!('gmd:geometricObjects')
50
+ end
51
+
52
+ end # gmd:MD_VectorSpatialRepresentation tag
53
+ end # writeXML
54
+ end # MD_VectorSpatialRepresentation class
55
+
56
+ end
57
+ end
58
+ end
59
59
  end
@@ -2,86 +2,90 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-01 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
9
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
5
+ # Stan Smith 2018-04-10 add error and warning messaging
6
+ # Stan Smith 2016-12-01 refactored for mdTranslator/mdJson 2.0
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 2014-12-12 refactored to handle namespacing readers and writers
10
11
  # Stan Smith 2013-11-15 original script
11
12
 
13
+ require_relative '../iso19115_2_writer'
14
+
12
15
  module ADIWG
13
- module Mdtranslator
14
- module Writers
15
- module Iso19115_2
16
+ module Mdtranslator
17
+ module Writers
18
+ module Iso19115_2
16
19
 
17
- class EX_VerticalExtent
20
+ class EX_VerticalExtent
18
21
 
19
- def initialize(xml, hResponseObj)
20
- @xml = xml
21
- @hResponseObj = hResponseObj
22
- end
22
+ def initialize(xml, hResponseObj)
23
+ @xml = xml
24
+ @hResponseObj = hResponseObj
25
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
26
+ end
23
27
 
24
- def writeXML(hVertEle)
28
+ def writeXML(hVertEle)
25
29
 
26
- @xml.tag!('gmd:EX_VerticalExtent') do
30
+ @xml.tag!('gmd:EX_VerticalExtent') do
27
31
 
28
- # vertical extent - minimum value (required)
29
- s = hVertEle[:minValue]
30
- if s.nil?
31
- @xml.tag!('gmd:minimumValue', {'gco:nilReason' => 'missing'})
32
- else
33
- @xml.tag!('gmd:minimumValue') do
34
- @xml.tag!('gco:Real', s)
35
- end
36
- end
32
+ # vertical extent - minimum value (required)
33
+ s = hVertEle[:minValue]
34
+ if s.nil?
35
+ @NameSpace.issueWarning(330, 'gmd:minimumValue')
36
+ else
37
+ @xml.tag!('gmd:minimumValue') do
38
+ @xml.tag!('gco:Real', s)
39
+ end
40
+ end
37
41
 
38
- # vertical extent - maximum value (required)
39
- s = hVertEle[:maxValue]
40
- if s.nil?
41
- @xml.tag!('gmd:maximumValue', {'gco:nilReason' => 'missing'})
42
- else
43
- @xml.tag!('gmd:maximumValue') do
44
- @xml.tag!('gco:Real', s)
45
- end
46
- end
42
+ # vertical extent - maximum value (required)
43
+ s = hVertEle[:maxValue]
44
+ if s.nil?
45
+ @NameSpace.issueWarning(331, 'gmd:maximumValue')
46
+ else
47
+ @xml.tag!('gmd:maximumValue') do
48
+ @xml.tag!('gco:Real', s)
49
+ end
50
+ end
47
51
 
48
- # vertical extent - vertical crs (attributes only) (required)
49
- attributes = {}
50
- title = nil
51
- href = nil
52
- hSpaceRef = hVertEle[:crsId]
53
- unless hSpaceRef.empty?
54
- hIdentifier = hSpaceRef[:systemIdentifier]
55
- unless hIdentifier.empty?
56
- title = hIdentifier[:identifier]
57
- href = hIdentifier[:namespace]
58
- hCitation = hIdentifier[:citation]
59
- unless hCitation.empty?
60
- hOnline = hCitation[:onlineResources][0]
61
- unless hOnline.empty?
62
- href = hOnline[:olResURI]
63
- end
64
- end
65
- end
66
- end
67
- unless href.nil?
68
- attributes['xlink:href'] = href
69
- end
70
- unless title.nil?
71
- attributes['xlink:title'] = title
72
- end
73
- unless attributes.empty?
74
- @xml.tag!('gmd:verticalCRS', attributes)
75
- end
76
- if attributes.empty?
77
- @xml.tag!('gmd:verticalCRS', {'gco:nilReason'=>'missing'})
78
- end
52
+ # vertical extent - vertical crs (attributes only) (required)
53
+ attributes = {}
54
+ title = nil
55
+ href = nil
56
+ hSpaceRef = hVertEle[:crsId]
57
+ unless hSpaceRef.empty?
58
+ hIdentifier = hSpaceRef[:systemIdentifier]
59
+ unless hIdentifier.empty?
60
+ title = hIdentifier[:identifier]
61
+ href = hIdentifier[:namespace]
62
+ hCitation = hIdentifier[:citation]
63
+ unless hCitation.empty?
64
+ hOnline = hCitation[:onlineResources][0]
65
+ unless hOnline.empty?
66
+ href = hOnline[:olResURI]
67
+ end
68
+ end
69
+ end
70
+ end
71
+ unless href.nil?
72
+ attributes['xlink:href'] = href
73
+ end
74
+ unless title.nil?
75
+ attributes['xlink:title'] = title
76
+ end
77
+ unless attributes.empty?
78
+ @xml.tag!('gmd:verticalCRS', attributes)
79
+ end
80
+ if attributes.empty?
81
+ @NameSpace.issueWarning(332, 'gmd:verticalCRS')
82
+ end
79
83
 
80
- end # EX_VerticalExtent tag
81
- end # writeXML
82
- end # EX_VerticalExtent class
84
+ end # EX_VerticalExtent tag
85
+ end # writeXML
86
+ end # EX_VerticalExtent class
83
87
 
84
- end
85
- end
86
- end
88
+ end
89
+ end
90
+ end
87
91
  end