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,90 +2,90 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-29 refactored for mdTranslator/mdJson 2.0
5
+ # Stan Smith 2016-11-29 refactored for mdTranslator/mdJson 2.0
6
6
  # Stan Smith 2015-08-27 original script.
7
7
 
8
8
  require_relative 'class_codelist'
9
9
 
10
10
  module ADIWG
11
- module Mdtranslator
12
- module Writers
13
- module Iso19115_2
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_2
14
14
 
15
- class MI_Band
15
+ class MI_Band
16
16
 
17
- def initialize(xml, hResponseObj)
18
- @xml = xml
19
- @hResponseObj = hResponseObj
20
- end
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
21
 
22
- def writeXML(hAttribute)
22
+ def writeXML(hAttribute)
23
23
 
24
- # classes used
25
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
24
+ # classes used
25
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
26
 
27
- # miBand - band boundary definition {MI_BandDefinition}
28
- s = hAttribute[:bandBoundaryDefinition]
29
- unless s.nil?
30
- @xml.tag!('gmi:bandBoundaryDefinition') do
31
- codelistClass.writeXML('gmi', 'iso_bandDefinition',s)
32
- end
33
- end
34
- if s.nil? && @hResponseObj[:writerShowTags]
35
- @xml.tag!('gmi:bandBoundaryDefinition')
36
- end
27
+ # miBand - band boundary definition {MI_BandDefinition}
28
+ s = hAttribute[:bandBoundaryDefinition]
29
+ unless s.nil?
30
+ @xml.tag!('gmi:bandBoundaryDefinition') do
31
+ codelistClass.writeXML('gmi', 'iso_bandDefinition', s)
32
+ end
33
+ end
34
+ if s.nil? && @hResponseObj[:writerShowTags]
35
+ @xml.tag!('gmi:bandBoundaryDefinition')
36
+ end
37
37
 
38
- # miBand - nominal spatial resolution {real}
39
- s = hAttribute[:nominalSpatialResolution]
40
- unless s.nil?
41
- @xml.tag!('gmi:nominalSpatialResolution') do
42
- @xml.tag!('gco:Real',s)
43
- end
44
- end
45
- if s.nil? && @hResponseObj[:writerShowTags]
46
- @xml.tag!('gmi:nominalSpatialResolution')
47
- end
38
+ # miBand - nominal spatial resolution {real}
39
+ s = hAttribute[:nominalSpatialResolution]
40
+ unless s.nil?
41
+ @xml.tag!('gmi:nominalSpatialResolution') do
42
+ @xml.tag!('gco:Real', s)
43
+ end
44
+ end
45
+ if s.nil? && @hResponseObj[:writerShowTags]
46
+ @xml.tag!('gmi:nominalSpatialResolution')
47
+ end
48
48
 
49
- # miBand - transfer function type code
50
- # {MI_TransferFunctionTypeCode}
51
- s = hAttribute[:transferFunctionType]
52
- unless s.nil?
53
- @xml.tag!('gmi:transferFunctionType') do
54
- codelistClass.writeXML('gmi', 'iso_transferFunctionTypeCode',s)
55
- end
56
- end
57
- if s.nil? && @hResponseObj[:writerShowTags]
58
- @xml.tag!('gmi:transferFunctionType')
59
- end
49
+ # miBand - transfer function type code
50
+ # {MI_TransferFunctionTypeCode}
51
+ s = hAttribute[:transferFunctionType]
52
+ unless s.nil?
53
+ @xml.tag!('gmi:transferFunctionType') do
54
+ codelistClass.writeXML('gmi', 'iso_transferFunctionTypeCode', s)
55
+ end
56
+ end
57
+ if s.nil? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('gmi:transferFunctionType')
59
+ end
60
60
 
61
- # miBand - transmitted polarization orientation code
62
- # {MI_PolarizationOrientationCode}
63
- s = hAttribute[:transmittedPolarization]
64
- unless s.nil?
65
- @xml.tag!('gmi:transmittedPolarisation') do
66
- codelistClass.writeXML('gmi','iso_polarisationOrientationCode',s)
67
- end
68
- end
69
- if s.nil? && @hResponseObj[:writerShowTags]
70
- @xml.tag!('gmi:transmittedPolarisation')
71
- end
61
+ # miBand - transmitted polarization orientation code
62
+ # {MI_PolarizationOrientationCode}
63
+ s = hAttribute[:transmittedPolarization]
64
+ unless s.nil?
65
+ @xml.tag!('gmi:transmittedPolarisation') do
66
+ codelistClass.writeXML('gmi', 'iso_polarisationOrientationCode', s)
67
+ end
68
+ end
69
+ if s.nil? && @hResponseObj[:writerShowTags]
70
+ @xml.tag!('gmi:transmittedPolarisation')
71
+ end
72
72
 
73
- # miBand - detected polarization orientation code
74
- # {MI_PolarizationOrientationCode}
75
- s = hAttribute[:detectedPolarization]
76
- unless s.nil?
77
- @xml.tag!('gmi:detectedPolarisation') do
78
- codelistClass.writeXML('gmi', 'iso_polarisationOrientationCode',s)
79
- end
80
- end
81
- if s.nil? && @hResponseObj[:writerShowTags]
82
- @xml.tag!('gmi:detectedPolarisation')
83
- end
73
+ # miBand - detected polarization orientation code
74
+ # {MI_PolarizationOrientationCode}
75
+ s = hAttribute[:detectedPolarization]
76
+ unless s.nil?
77
+ @xml.tag!('gmi:detectedPolarisation') do
78
+ codelistClass.writeXML('gmi', 'iso_polarisationOrientationCode', s)
79
+ end
80
+ end
81
+ if s.nil? && @hResponseObj[:writerShowTags]
82
+ @xml.tag!('gmi:detectedPolarisation')
83
+ end
84
84
 
85
- end # writeXML
86
- end # MI_Band attributes
85
+ end # writeXML
86
+ end # MI_Band attributes
87
87
 
88
- end
89
- end
90
- end
88
+ end
89
+ end
90
+ end
91
91
  end
@@ -2,6 +2,8 @@
2
2
  # 19115-2 writer output in XML.
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-05-03 add variable for changing XSD location
6
+ # Stan Smith 2018-04-10 add error and warning messaging
5
7
  # Stan Smith 2018-01-27 add metadata constraints
6
8
  # Stan Smith 2016-11-15 refactored for mdTranslator/mdJson 2.0
7
9
  # Stan Smith 2015-08-27 added support for content information
@@ -37,6 +39,7 @@
37
39
 
38
40
  require 'uuidtools'
39
41
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
42
+ require_relative '../iso19115_2_writer'
40
43
  require_relative 'class_codelist'
41
44
  require_relative 'class_hierarchy'
42
45
  require_relative 'class_responsibleParty'
@@ -64,6 +67,7 @@ module ADIWG
64
67
  def initialize(xml, hResponseObj)
65
68
  @xml = xml
66
69
  @hResponseObj = hResponseObj
70
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
67
71
  end
68
72
 
69
73
  def writeXML(intObj)
@@ -104,6 +108,11 @@ module ADIWG
104
108
  @xml.comment!('ADIwg is not responsible for the content of this metadata record')
105
109
  @xml.comment!('This metadata record was generated by mdTranslator ' + version + ' at ' + Time.now.to_s)
106
110
 
111
+ # schema locations
112
+ # set to 'remoteSchema' before publishing
113
+ localSchema = 'C:\Users\StanSmith\Projects\ISO\19115\NOAA\schema.xsd'
114
+ remoteSchema = 'ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd'
115
+
107
116
  # MI_Metadata
108
117
  @xml.tag!('gmi:MI_Metadata',
109
118
  {'xmlns:gmi' => 'http://www.isotc211.org/2005/gmi',
@@ -118,13 +127,7 @@ module ADIWG
118
127
  'xmlns:srv' => 'http://www.isotc211.org/2005/srv',
119
128
  'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
120
129
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
121
- 'xsi:schemaLocation' => 'http://www.isotc211.org/2005/gmi ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd'}) do
122
-
123
- # remote schema location - for deployment
124
- # ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd
125
-
126
- # local schema location - for development
127
- # C:\Users\StanSmith\Projects\ISO\19115\NOAA\schema.xsd
130
+ 'xsi:schemaLocation' => "http://www.isotc211.org/2005/gmi #{remoteSchema}"}) do
128
131
 
129
132
  # metadata information - file identifier (default: UUID)
130
133
  s = hMetaInfo[:metadataIdentifier][:identifier]
@@ -176,7 +179,7 @@ module ADIWG
176
179
  @xml.tag!('gmd:hierarchyLevelName')
177
180
  end
178
181
 
179
- # metadata information - metadata contacts (required)
182
+ # metadata information - metadata contact [] (required)
180
183
  # [{CI_ResponsibleParty}]
181
184
  aRParties = hMetaInfo[:metadataContacts]
182
185
  aRParties.each do |hRParty|
@@ -184,12 +187,12 @@ module ADIWG
184
187
  aParties = hRParty[:parties]
185
188
  aParties.each do |hParty|
186
189
  @xml.tag!('gmd:contact') do
187
- partyClass.writeXML(role, hParty)
190
+ partyClass.writeXML(role, hParty, 'metadata contact')
188
191
  end
189
192
  end
190
193
  end
191
194
  if aRParties.empty?
192
- @xml.tag!('gmd:contact', {'gco:nilReason' => 'missing'})
195
+ @NameSpace.issueWarning(240, 'gmd:contact')
193
196
  end
194
197
 
195
198
  # metadata information - date stamp (required) {default: now()}
@@ -236,7 +239,7 @@ module ADIWG
236
239
  end
237
240
  aLocales.each do |hLocale|
238
241
  @xml.tag!('gmd:locale') do
239
- localeClass.writeXML(hLocale)
242
+ localeClass.writeXML(hLocale, 'metadata information locale')
240
243
  end
241
244
  end
242
245
  if aLocales.empty? && @hResponseObj[:writerShowTags]
@@ -299,17 +302,49 @@ module ADIWG
299
302
  end
300
303
  end
301
304
  if hResInfo.empty?
302
- @xml.tag!('gmd:identificationInfo', {'gco:nilReason' => 'missing'})
305
+ @NameSpace.issueWarning(241, 'gmd:identificationInfo')
303
306
  end
304
307
 
305
308
  # ###################### End Data Identification #######################
306
309
 
307
310
  # metadata information - coverageDescription []
308
311
  aItems = hResInfo[:coverageDescriptions]
309
- aItems.each do |hItem|
310
- @xml.tag!('gmd:contentInfo') do
311
- coverageClass.writeXML(hItem)
312
+ aItems.each do |hCoverage|
313
+
314
+ # mdJson follows ISO 19115-1 for this section
315
+ # in ISO 19115-1
316
+ # coverageDescription << attributeGroup << attribute (rangeDimension)
317
+ # in ISO 19115-2
318
+ # coverageDescription << attribute (rangeDimension)
319
+ # how to handle in ISO 19115-2 ...
320
+ # break up attributeGroup, handle each in separate coverageDescription
321
+ # handle image and attributeGroup in separate coverageDescriptions
322
+ # also allow both attributeGroup and imageDescription to be empty
323
+
324
+ if hCoverage[:imageDescription].empty? && hCoverage[:attributeGroups].empty?
325
+ @xml.tag!('gmd:contentInfo') do
326
+ coverageClass.writeXML(hCoverage)
327
+ end
312
328
  end
329
+
330
+ unless hCoverage[:imageDescription].empty?
331
+ hInstance = Marshal::load(Marshal.dump(hCoverage))
332
+ hInstance[:attributeGroups] = []
333
+ @xml.tag!('gmd:contentInfo') do
334
+ coverageClass.writeXML(hInstance)
335
+ end
336
+ end
337
+
338
+ hCoverage[:attributeGroups].each do |hGroup|
339
+ hInstance = Marshal::load(Marshal.dump(hCoverage))
340
+ hInstance[:imageDescription] = {}
341
+ hInstance[:attributeGroups] = []
342
+ hInstance[:attributeGroups] << hGroup
343
+ @xml.tag!('gmd:contentInfo') do
344
+ coverageClass.writeXML(hInstance)
345
+ end
346
+ end
347
+
313
348
  end
314
349
  if aItems.empty? && @hResponseObj[:writerShowTags]
315
350
  @xml.tag!('gmd:contentInfo')
@@ -363,7 +398,7 @@ module ADIWG
363
398
  hMaintenance = hMetaInfo[:metadataMaintenance]
364
399
  unless hMaintenance.empty?
365
400
  @xml.tag!('gmd:metadataMaintenance') do
366
- maintenanceClass.writeXML(hMaintenance)
401
+ maintenanceClass.writeXML(hMaintenance, 'metadata maintenance')
367
402
  end
368
403
  end
369
404
  if hMaintenance.empty? && @hResponseObj[:writerShowTags]
@@ -2,83 +2,83 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-06 original script
5
+ # Stan Smith 2016-12-06 original script
6
6
 
7
7
  require 'adiwg/mdtranslator/internal/module_coordinates'
8
8
  require_relative 'class_lineString'
9
9
  require_relative 'class_featureProperties'
10
10
 
11
11
  module ADIWG
12
- module Mdtranslator
13
- module Writers
14
- module Iso19115_2
15
-
16
- class MultiLineString
17
-
18
- def initialize(xml, hResponseObj)
19
- @xml = xml
20
- @hResponseObj = hResponseObj
21
- end
22
-
23
- def writeXML(hGeoObject, hProperties, objId)
24
-
25
- # classes used
26
- geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
-
28
- # classes used
29
- lineClass = LineString.new(@xml, @hResponseObj)
30
-
31
- # multiLineString attributes
32
- attributes = {}
33
-
34
- # multiLineString attributes - gml:id (required)
35
- if objId.nil?
36
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
- objId = 'multiLine' + @hResponseObj[:writerMissingIdCount]
38
- else
39
- objId.gsub!(/[^0-9a-zA-Z]/,'')
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_2
15
+
16
+ class MultiLineString
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ end
22
+
23
+ def writeXML(hGeoObject, hProperties, objId)
24
+
25
+ # classes used
26
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
+
28
+ # classes used
29
+ lineClass = LineString.new(@xml, @hResponseObj)
30
+
31
+ # multiLineString attributes
32
+ attributes = {}
33
+
34
+ # multiLineString attributes - gml:id (required)
35
+ if objId.nil?
36
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
+ objId = 'multiLine' + @hResponseObj[:writerMissingIdCount]
38
+ else
39
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
40
+ end
41
+ attributes['gml:id'] = objId
42
+
43
+ # multiLineString attributes - srsDimension
44
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
+ if !s.nil?
46
+ attributes[:srsDimension] = s
47
+ end
48
+
49
+ # multiLineString attributes - srsName (GeoJSON is WGS84)
50
+ attributes[:srsName] = 'WGS84'
51
+
52
+ @xml.tag!('gml:MultiGeometry', attributes) do
53
+
54
+ # multiLineString - properties for Feature
55
+ unless hProperties.empty?
56
+ geoPropClass.writeXML(hProperties)
57
+ end
58
+ if hProperties.empty? && @hResponseObj[:writerShowTags]
59
+ @xml.tag!('gml:description')
60
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
61
+ @xml.tag!('gml:name')
62
+ end
63
+
64
+ # multiLineString - lineString members (required)
65
+ @xml.tag!('gml:geometryMembers') do
66
+ unless hGeoObject[:coordinates].empty?
67
+ aLines = hGeoObject[:coordinates]
68
+ aLines.each do |aLine|
69
+ newLine = {}
70
+ newLine[:type] = 'LineString'
71
+ newLine[:coordinates] = aLine
72
+ lineClass.writeXML(newLine, {}, nil)
73
+ end
40
74
  end
41
- attributes['gml:id'] = objId
75
+ end
42
76
 
43
- # multiLineString attributes - srsDimension
44
- s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
- if !s.nil?
46
- attributes[:srsDimension] = s
47
- end
77
+ end # gml:MultiGeometry tag
78
+ end # writeXML
79
+ end # MultiLineString class
48
80
 
49
- # multiLineString attributes - srsName (GeoJSON is WGS84)
50
- attributes[:srsName] = 'WGS84'
51
-
52
- @xml.tag!('gml:MultiGeometry', attributes) do
53
-
54
- # multiLineString - properties for Feature
55
- unless hProperties.empty?
56
- geoPropClass.writeXML(hProperties)
57
- end
58
- if hProperties.empty? && @hResponseObj[:writerShowTags]
59
- @xml.tag!('gml:description')
60
- @xml.tag!('gml:identifier', {'codeSpace'=>''})
61
- @xml.tag!('gml:name')
62
- end
63
-
64
- # multiLineString - lineString members (required)
65
- @xml.tag!('gml:geometryMembers') do
66
- unless hGeoObject[:coordinates].empty?
67
- aLines = hGeoObject[:coordinates]
68
- aLines.each do |aLine|
69
- newLine = {}
70
- newLine[:type] = 'LineString'
71
- newLine[:coordinates] = aLine
72
- lineClass.writeXML(newLine, {}, nil)
73
- end
74
- end
75
- end
76
-
77
- end # gml:MultiGeometry tag
78
- end # writeXML
79
- end # MultiLineString class
80
-
81
- end
82
- end
83
- end
81
+ end
82
+ end
83
+ end
84
84
  end