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,90 @@
1
+ # ISO <<Class>> MD_Band attributes
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-08 original script.
6
+
7
+ require_relative 'class_codelist'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class MI_Band
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hAttribute)
22
+
23
+ # classes used
24
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
25
+
26
+ # miBand - band boundary definition {MI_BandDefinition}
27
+ s = hAttribute[:bandBoundaryDefinition]
28
+ unless s.nil?
29
+ @xml.tag!('mrc:bandBoundaryDefinition') do
30
+ codelistClass.writeXML('mrc', 'iso_bandDefinition', s)
31
+ end
32
+ end
33
+ if s.nil? && @hResponseObj[:writerShowTags]
34
+ @xml.tag!('mrc:bandBoundaryDefinition')
35
+ end
36
+
37
+ # miBand - nominal spatial resolution {real}
38
+ s = hAttribute[:nominalSpatialResolution]
39
+ unless s.nil?
40
+ @xml.tag!('mrc:nominalSpatialResolution') do
41
+ @xml.tag!('gco:Real', s)
42
+ end
43
+ end
44
+ if s.nil? && @hResponseObj[:writerShowTags]
45
+ @xml.tag!('mrc:nominalSpatialResolution')
46
+ end
47
+
48
+ # miBand - transfer function type code
49
+ # {MI_TransferFunctionTypeCode}
50
+ s = hAttribute[:transferFunctionType]
51
+ unless s.nil?
52
+ @xml.tag!('mrc:transferFunctionType') do
53
+ codelistClass.writeXML('mrc', 'iso_transferFunctionTypeCode', s)
54
+ end
55
+ end
56
+ if s.nil? && @hResponseObj[:writerShowTags]
57
+ @xml.tag!('mrc:transferFunctionType')
58
+ end
59
+
60
+ # miBand - transmitted polarization orientation code
61
+ # {MI_PolarizationOrientationCode}
62
+ s = hAttribute[:transmittedPolarization]
63
+ unless s.nil?
64
+ @xml.tag!('mrc:transmittedPolarisation') do
65
+ codelistClass.writeXML('mrc', 'iso_polarisationOrientationCode', s)
66
+ end
67
+ end
68
+ if s.nil? && @hResponseObj[:writerShowTags]
69
+ @xml.tag!('mrc:transmittedPolarisation')
70
+ end
71
+
72
+ # miBand - detected polarization orientation code
73
+ # {MI_PolarizationOrientationCode}
74
+ s = hAttribute[:detectedPolarization]
75
+ unless s.nil?
76
+ @xml.tag!('mrc:detectedPolarisation') do
77
+ codelistClass.writeXML('mrc', 'iso_polarisationOrientationCode', s)
78
+ end
79
+ end
80
+ if s.nil? && @hResponseObj[:writerShowTags]
81
+ @xml.tag!('mrc:detectedPolarisation')
82
+ end
83
+
84
+ end # writeXML
85
+ end # MI_Band attributes
86
+
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,84 @@
1
+ # GML MultiLineSting
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/module_coordinates'
8
+ require_relative 'class_lineString'
9
+ require_relative 'class_featureProperties'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
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
74
+ end
75
+ end
76
+
77
+ end # gml:MultiGeometry tag
78
+ end # writeXML
79
+ end # MultiLineString class
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ # GML MultiPoint
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/module_coordinates'
8
+ require_relative 'class_point'
9
+ require_relative 'class_featureProperties'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MultiPoint
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
+ pointClass = Point.new(@xml, @hResponseObj)
30
+
31
+ # multiPoint attributes
32
+ attributes = {}
33
+
34
+ # multiPoint attributes - gml:id (required)
35
+ if objId.nil?
36
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
+ objId = 'multiPoint' + @hResponseObj[:writerMissingIdCount]
38
+ else
39
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
40
+ end
41
+ attributes['gml:id'] = objId
42
+
43
+ # multiPoint attributes - srsDimension
44
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
+ if !s.nil?
46
+ attributes[:srsDimension] = s
47
+ end
48
+
49
+ # multiPoint attributes - srsName (GeoJSON is WGS84)
50
+ attributes[:srsName] = 'WGS84'
51
+
52
+ @xml.tag!('gml:MultiPoint', attributes) do
53
+
54
+ # multipoint - 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
+ # multipoint - point members (required)
65
+ @xml.tag!('gml:pointMembers') do
66
+ unless hGeoObject[:coordinates].empty?
67
+ aPoints = hGeoObject[:coordinates]
68
+ aPoints.each do |aPoint|
69
+ newPoint = {}
70
+ newPoint[:type] = 'Point'
71
+ newPoint[:coordinates] = aPoint
72
+ pointClass.writeXML(newPoint, {}, nil)
73
+ end
74
+ end
75
+ end
76
+
77
+ end # gml:Point tag
78
+ end # writeXML
79
+ end # multiPoint class
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ # GML MultiPolygon
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/module_coordinates'
8
+ require_relative 'class_polygon'
9
+ require_relative 'class_featureProperties'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MultiPolygon
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
+ polyClass = Polygon.new(@xml, @hResponseObj)
30
+
31
+ # multiPolygon attributes
32
+ attributes = {}
33
+
34
+ # multiPolygon attributes - gml:id (required)
35
+ if objId.nil?
36
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
+ objId = 'multiPolygon' + @hResponseObj[:writerMissingIdCount]
38
+ else
39
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
40
+ end
41
+ attributes['gml:id'] = objId
42
+
43
+ # multiPolygon attributes - srsDimension
44
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
+ if !s.nil?
46
+ attributes[:srsDimension] = s
47
+ end
48
+
49
+ # multiPolygon attributes - srsName (GeoJSON is WGS84)
50
+ attributes[:srsName] = 'WGS84'
51
+
52
+ @xml.tag!('gml:MultiGeometry', attributes) do
53
+
54
+ # multiPolygon - 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
+ # multiPolygon - polygon members (required)
65
+ @xml.tag!('gml:geometryMembers') do
66
+ unless hGeoObject[:coordinates].empty?
67
+ aPolys = hGeoObject[:coordinates]
68
+ aPolys.each do |aPoly|
69
+ newPoly = {}
70
+ newPoly[:type] = 'Polygon'
71
+ newPoly[:coordinates] = aPoly
72
+ polyClass.writeXML(newPoly, {}, nil)
73
+ end
74
+ end
75
+ end
76
+
77
+ end # gml:MultiGeometry tag
78
+ end # writeXML
79
+ end # MultiPolygon class
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,91 @@
1
+ # ISO <<Class>> CI_OnlineResource
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-14 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_codelist'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class CI_OnlineResource
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(hOlResource, inContext = nil)
24
+
25
+ # classes used
26
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
+
28
+ @xml.tag! 'cit:CI_OnlineResource' do
29
+
30
+ # online resource - link - required
31
+ unless hOlResource[:olResURI].nil?
32
+ @xml.tag!('cit:linkage') do
33
+ @xml.tag!('gco:CharacterString', hOlResource[:olResURI])
34
+ end
35
+ end
36
+ if hOlResource[:olResURI].nil?
37
+ @NameSpace.issueWarning(250, 'cit:linkage', inContext)
38
+ end
39
+
40
+ # online resource - protocol
41
+ unless hOlResource[:olResProtocol].nil?
42
+ @xml.tag!('cit:protocol') do
43
+ @xml.tag!('gco:CharacterString', hOlResource[:olResProtocol])
44
+ end
45
+ end
46
+ if hOlResource[:olResProtocol].nil? && @hResponseObj[:writerShowTags]
47
+ @xml.tag!('cit:protocol')
48
+ end
49
+
50
+ # online resource - application profile - not implemented
51
+
52
+ # online resource - link name
53
+ unless hOlResource[:olResName].nil?
54
+ @xml.tag!('cit:name') do
55
+ @xml.tag!('gco:CharacterString', hOlResource[:olResName])
56
+ end
57
+ end
58
+ if hOlResource[:olResName].nil? && @hResponseObj[:writerShowTags]
59
+ @xml.tag!('cit:name')
60
+ end
61
+
62
+ # online resource - link description
63
+ unless hOlResource[:olResDesc].nil?
64
+ @xml.tag!('cit:description') do
65
+ @xml.tag!('gco:CharacterString', hOlResource[:olResDesc])
66
+ end
67
+ end
68
+ if hOlResource[:olResDesc].nil? && @hResponseObj[:writerShowTags]
69
+ @xml.tag!('cit:description')
70
+ end
71
+
72
+ # online resource - link function {CI_OnLineFunctionCode}
73
+ unless hOlResource[:olResFunction].nil?
74
+ @xml.tag!('cit:function') do
75
+ codelistClass.writeXML('cit', 'iso_onlineFunction', hOlResource[:olResFunction])
76
+ end
77
+ end
78
+ if hOlResource[:olResFunction].nil? && @hResponseObj[:writerShowTags]
79
+ @xml.tag!('cit:function')
80
+ end
81
+
82
+ # online resource - protocol request - not implemented
83
+
84
+ end # CI_OnlineResource tag
85
+ end # write XML
86
+ end # CI_OnlineResource class
87
+
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,79 @@
1
+ # ISO <<Class>> MD_StandardOrderProcess
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-10 original script.
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class MD_StandardOrderProcess
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hOrder)
20
+
21
+ @xml.tag!('mrd:MD_StandardOrderProcess') do
22
+
23
+ # order process - fees
24
+ unless hOrder[:fees].nil?
25
+ @xml.tag!('mrd:fees') do
26
+ @xml.tag!('gco:CharacterString', hOrder[:fees])
27
+ end
28
+ end
29
+ if hOrder[:fees].nil? && @hResponseObj[:writerShowTags]
30
+ @xml.tag!('mrd:fees')
31
+ end
32
+
33
+ # order process - plannedAvailableDateTime {DateTime}
34
+ hDateTime = hOrder[:plannedAvailability]
35
+ unless hDateTime.empty?
36
+ paDateTime = hDateTime[:dateTime]
37
+ paDateRes = hDateTime[:dateResolution]
38
+ @xml.tag!('mrd:plannedAvailableDateTime') do
39
+ dateTimeStr =
40
+ AdiwgDateTimeFun.stringDateTimeFromDateTime(paDateTime, paDateRes)
41
+ @xml.tag!('gco:DateTime', dateTimeStr)
42
+ end
43
+ end
44
+ if hDateTime.empty? && @hResponseObj[:writerShowTags]
45
+ @xml.tag!('mrd:plannedAvailableDateTime')
46
+ end
47
+
48
+ # order process - orderingInstructions
49
+ unless hOrder[:orderingInstructions].nil?
50
+ @xml.tag!('mrd:orderingInstructions') do
51
+ @xml.tag!('gco:CharacterString', hOrder[:orderingInstructions])
52
+ end
53
+ end
54
+ if hOrder[:orderingInstructions].nil? && @hResponseObj[:writerShowTags]
55
+ @xml.tag!('mrd:orderingInstructions')
56
+ end
57
+
58
+ # order process - turnaround
59
+ unless hOrder[:turnaround].nil?
60
+ @xml.tag!('mrd:turnaround') do
61
+ @xml.tag!('gco:CharacterString', hOrder[:turnaround])
62
+ end
63
+ end
64
+ if hOrder[:turnaround].nil? && @hResponseObj[:writerShowTags]
65
+ @xml.tag!('mrd:turnaround')
66
+ end
67
+
68
+ # order process - orderOptions - not implemented
69
+
70
+ # order process - orderOptionsType - not implemented
71
+
72
+ end # mrd:MD_StandardOrderProcess tag
73
+ end # writeXML
74
+ end # MD_StandardOrderProcess class
75
+
76
+ end
77
+ end
78
+ end
79
+ end