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,60 @@
1
+ # ISO <<Class>> MD_GeometricObjects
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-16 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 MD_GeometricObjects
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(hGeoObj, inContext = nil)
24
+
25
+ # classes used
26
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'geometric object'
29
+ outContext = inContext + ' geometric object' unless inContext.nil?
30
+
31
+ @xml.tag!('msr:MD_GeometricObjects') do
32
+
33
+ # geometric object - object type (required)
34
+ unless hGeoObj[:objectType].nil?
35
+ @xml.tag!('msr:geometricObjectType') do
36
+ codelistClass.writeXML('msr', 'iso_geometricObjectType', hGeoObj[:objectType])
37
+ end
38
+ end
39
+ if hGeoObj[:objectType].nil?
40
+ @NameSpace.issueWarning(150, 'msr:geometricObjectType', outContext)
41
+ end
42
+
43
+ # geometric object - object count
44
+ unless hGeoObj[:objectCount].nil?
45
+ @xml.tag!('msr:geometricObjectCount') do
46
+ @xml.tag!('gco:Integer', hGeoObj[:objectCount].to_s)
47
+ end
48
+ end
49
+ if hGeoObj[:objectCount].nil? && @hResponseObj[:writerShowTags]
50
+ @xml.tag!('msr:geometricObjectCount')
51
+ end
52
+
53
+ end # msr:MD_GeometricObjects tag
54
+ end # writeXML
55
+ end # MD_GeometricObjects class
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,97 @@
1
+ # GeoJSON GeometryCollection
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_point'
9
+ require_relative 'class_lineString'
10
+ require_relative 'class_polygon'
11
+ require_relative 'class_multiPoint'
12
+ require_relative 'class_multiLine'
13
+ require_relative 'class_multiPolygon'
14
+ require_relative 'class_featureProperties'
15
+
16
+ module ADIWG
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19115_1
20
+
21
+ class GeometryCollection
22
+
23
+ def initialize(xml, hResponseObj)
24
+ @xml = xml
25
+ @hResponseObj = hResponseObj
26
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
27
+ end
28
+
29
+ def writeXML(hGeoObject, hProperties, objId)
30
+
31
+ # classes used
32
+ pointClass = Point.new(@xml, @hResponseObj)
33
+ lineClass = LineString.new(@xml, @hResponseObj)
34
+ polyClass = Polygon.new(@xml, @hResponseObj)
35
+ multiPointClass = MultiPoint.new(@xml, @hResponseObj)
36
+ multiLineClass = MultiLineString.new(@xml, @hResponseObj)
37
+ multiPolyClass = MultiPolygon.new(@xml, @hResponseObj)
38
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
39
+
40
+ # geometry collection attributes
41
+ attributes = {}
42
+
43
+ # geometry collection attributes - gml:id (required)
44
+ if objId.nil?
45
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
46
+ objId = 'geometryCollection' + @hResponseObj[:writerMissingIdCount]
47
+ else
48
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
49
+ end
50
+ attributes['gml:id'] = objId
51
+
52
+ # geometry collection attributes - srsName (GeoJSON is WGS84)
53
+ attributes[:srsName] = 'WGS84'
54
+
55
+ @xml.tag!('gml:MultiGeometry', attributes) do
56
+
57
+ # geometry collection - properties for Feature
58
+ unless hProperties.empty?
59
+ geoPropClass.writeXML(hProperties)
60
+ end
61
+
62
+ # geometry collection - geometry objects (required)
63
+ unless hGeoObject[:geometryObjects].empty?
64
+ @xml.tag!('gml:geometryMembers') do
65
+ aObjects = hGeoObject[:geometryObjects]
66
+ aObjects.each do |hGeoObj|
67
+ case hGeoObj[:type]
68
+ when 'Point'
69
+ pointClass.writeXML(hGeoObj, {}, nil)
70
+ when 'LineString'
71
+ lineClass.writeXML(hGeoObj, {}, nil)
72
+ when 'Polygon'
73
+ polyClass.writeXML(hGeoObj, {}, nil)
74
+ when 'MultiPoint'
75
+ multiPointClass.writeXML(hGeoObj, {}, nil)
76
+ when 'MultiLineString'
77
+ multiLineClass.writeXML(hGeoObj, {}, nil)
78
+ when 'MultiPolygon'
79
+ multiPolyClass.writeXML(hGeoObj, {}, nil)
80
+ else
81
+ @NameSpace.issueNotice(160, "#{hGeoObj[:type]}")
82
+ end
83
+ end
84
+ end
85
+ end
86
+ if hGeoObject[:geometryObjects].empty?
87
+ @NameSpace.issueWarning(161, nil, 'geometry collection')
88
+ end
89
+
90
+ end # gml:MultiGeometry tag
91
+ end # writeXML
92
+ end # GeometryCollection class
93
+
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,121 @@
1
+ # ISO <<Class>> MD_Georectified
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-16 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_grid'
9
+ require_relative 'class_point'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MD_Georectified
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
22
+ end
23
+
24
+ def writeXML(hGeoRec, inContext = nil)
25
+
26
+ # classes used
27
+ gridClass = Grid.new(@xml, @hResponseObj)
28
+ pointClass = Point.new(@xml, @hResponseObj)
29
+
30
+ outContext = 'georectified representation'
31
+ outContext = inContext + ' georectified representation' unless inContext.nil?
32
+
33
+ @xml.tag!('msr:MD_Georectified') do
34
+
35
+ # georectified - add grid info
36
+ hGrid = hGeoRec[:gridRepresentation]
37
+ gridClass.writeXML(hGrid, outContext)
38
+
39
+ # georectified - checkpoint availability
40
+ @xml.tag!('msr:checkPointAvailability') do
41
+ @xml.tag!('gco:Boolean', hGeoRec[:checkPointAvailable])
42
+ end
43
+
44
+ # georectified - checkpoint description
45
+ unless hGeoRec[:checkPointDescription].nil?
46
+ @xml.tag!('msr:checkPointDescription') do
47
+ @xml.tag!('gco:CharacterString', hGeoRec[:checkPointDescription])
48
+ end
49
+ end
50
+ if hGeoRec[:checkPointDescription].nil? && @hResponseObj[:writerShowTags]
51
+ @xml.tag!('msr:checkPointDescription')
52
+ end
53
+
54
+ # georectified - corner points (2 or 4 required)
55
+ aCoords = hGeoRec[:cornerPoints]
56
+ aCoords.each do |aPoint|
57
+ hPoint = {}
58
+ hPoint[:type] = 'Point'
59
+ hPoint[:coordinates] = aPoint
60
+ @xml.tag!('msr:cornerPoints') do
61
+ pointClass.writeXML(hPoint, {}, nil)
62
+ end
63
+ end
64
+ if aCoords.empty?
65
+ @NameSpace.issueWarning(170, 'msr:cornerPoints', 'spatial representation')
66
+ end
67
+ unless (aCoords.length == 2 || aCoords.length == 4)
68
+ @NameSpace.issueWarning(172, 'msr:cornerPoints', 'spatial representation')
69
+ end
70
+
71
+ # georectified - center point
72
+ aCoords = hGeoRec[:centerPoint]
73
+ unless aCoords.empty?
74
+ hPoint = {}
75
+ hPoint[:type] = 'Point'
76
+ hPoint[:coordinates] = aCoords
77
+ @xml.tag!('msr:centrePoint') do
78
+ pointClass.writeXML(hPoint, {}, nil)
79
+ end
80
+ end
81
+ if aCoords.empty? && @hResponseObj[:writerShowTags]
82
+ @xml.tag!('msr:centrePoint')
83
+ end
84
+
85
+ # georectified - point in pixel (required)
86
+ if hGeoRec[:pointInPixel].nil?
87
+ @NameSpace.issueWarning(171, 'msr:pointInPixel', 'spatial representation')
88
+ else
89
+ @xml.tag!('msr:pointInPixel') do
90
+ @xml.tag!('msr:MD_PixelOrientationCode', hGeoRec[:pointInPixel])
91
+ end
92
+ end
93
+
94
+ # georectified - transformation dimension description
95
+ unless hGeoRec[:transformationDimensionDescription].nil?
96
+ @xml.tag!('msr:transformationDimensionDescription') do
97
+ @xml.tag!('gco:CharacterString', hGeoRec[:transformationDimensionDescription])
98
+ end
99
+ end
100
+ if hGeoRec[:transformationDimensionDescription].nil? && @hResponseObj[:writerShowTags]
101
+ @xml.tag!('msr:transformationDimensionDescription')
102
+ end
103
+
104
+ # georectified - transformation dimension mapping
105
+ unless hGeoRec[:transformationDimensionMapping].nil?
106
+ @xml.tag!('msr:transformationDimensionMapping') do
107
+ @xml.tag!('gco:CharacterString', hGeoRec[:transformationDimensionMapping])
108
+ end
109
+ end
110
+ if hGeoRec[:transformationDimensionMapping].nil? && @hResponseObj[:writerShowTags]
111
+ @xml.tag!('msr:transformationDimensionMapping')
112
+ end
113
+
114
+ end # msr:MD_Georectified tag
115
+ end # writeXML
116
+ end # MD_Georectified class
117
+
118
+ end
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,87 @@
1
+ # ISO <<Class>> MD_Georeferenceable
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-16 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_grid'
9
+ require_relative 'class_citation'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MD_Georeferenceable
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
22
+ end
23
+
24
+ def writeXML(hGeoRef, inContext = nil)
25
+
26
+ # classes used
27
+ gridClass = Grid.new(@xml, @hResponseObj)
28
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
29
+
30
+ outContext = 'georeferenceable representation'
31
+ outContext = inContext + ' georeferenceable representation' unless inContext.nil?
32
+
33
+ @xml.tag!('msr:MD_Georeferenceable') do
34
+
35
+ # georeferenceable - add grid info (required)
36
+ hGrid = hGeoRef[:gridRepresentation]
37
+ gridClass.writeXML(hGrid, outContext)
38
+
39
+ # georeferenceable - control point availability (required)
40
+ @xml.tag!('msr:controlPointAvailability') do
41
+ @xml.tag!('gco:Boolean', hGeoRef[:orientationParameterAvailable])
42
+ end
43
+
44
+ # georeferenceable - orientation parameter availability (required)
45
+ @xml.tag!('msr:orientationParameterAvailability') do
46
+ @xml.tag!('gco:Boolean', hGeoRef[:orientationParameterAvailable])
47
+ end
48
+
49
+ # georeferenceable - orientation parameter description
50
+ unless hGeoRef[:orientationParameterDescription].nil?
51
+ @xml.tag!('msr:orientationParameterDescription') do
52
+ @xml.tag!('gco:CharacterString', hGeoRef[:orientationParameterDescription])
53
+ end
54
+ end
55
+ if hGeoRef[:orientationParameterDescription].nil? && @hResponseObj[:writerShowTags]
56
+ @xml.tag!('msr:orientationParameterDescription')
57
+ end
58
+
59
+ # georeferenceable - georeferenced parameter (required)
60
+ unless hGeoRef[:georeferencedParameter].nil?
61
+ @xml.tag!('msr:georeferencedParameters') do
62
+ @xml.tag!('gco:Record', hGeoRef[:georeferencedParameter])
63
+ end
64
+ end
65
+ if hGeoRef[:georeferencedParameter].nil?
66
+ @NameSpace.issueWarning(180, 'msr:georeferencedParameters', outContext)
67
+ end
68
+
69
+ # georeferenceable - parameter citation [] {citation}
70
+ aCitation = hGeoRef[:parameterCitation]
71
+ aCitation.each do |hCitation|
72
+ @xml.tag!('msr:parameterCitation') do
73
+ citationClass.writeXML(hCitation, outContext)
74
+ end
75
+ end
76
+ if aCitation.empty? && @hResponseObj[:writerShowTags]
77
+ @xml.tag!('msr:parameterCitation')
78
+ end
79
+
80
+ end # msr:MD_Georeferenceable tag
81
+ end # writeXML
82
+ end # MD_Georeferenceable class
83
+
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,32 @@
1
+ # GML Identifier
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-19 original script.
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class GMLIdentifier
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hGMLid)
20
+
21
+ namespace = hGMLid[:namespace]
22
+ identifier = hGMLid[:identifier]
23
+
24
+ @xml.tag!('gml:identifier', {'codeSpace' => namespace}, identifier)
25
+
26
+ end # writeXML
27
+ end # GMLIdentifier class
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,71 @@
1
+ # ISO <<Class>> GridRepresentation
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-16 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_dimension'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class Grid
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(hGrid, inContext = nil)
24
+
25
+ # classes used
26
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
+ dimensionClass = MD_Dimension.new(@xml, @hResponseObj)
28
+
29
+ # grid - number of dimensions (required)
30
+ unless hGrid[:numberOfDimensions].nil?
31
+ @xml.tag!('msr:numberOfDimensions') do
32
+ @xml.tag!('gco:Integer', hGrid[:numberOfDimensions].to_s)
33
+ end
34
+ end
35
+ if hGrid[:numberOfDimensions].nil?
36
+ @NameSpace.issueWarning(190, 'msr:numberOfDimensions', inContext)
37
+ end
38
+
39
+ # grid - axis dimension properties [] {MD_Dimension}
40
+ aDims = hGrid[:dimension]
41
+ aDims.each do |hDimension|
42
+ @xml.tag!('msr:axisDimensionProperties') do
43
+ dimensionClass.writeXML(hDimension, inContext)
44
+ end
45
+ end
46
+ if aDims.empty? && @hResponseObj[:writerShowTags]
47
+ @xml.tag!('msr:axisDimensionProperties')
48
+ end
49
+
50
+ # grid - cell geometry (required)
51
+ unless hGrid[:cellGeometry].nil?
52
+ @xml.tag!('msr:cellGeometry') do
53
+ codelistClass.writeXML('msr', 'iso_cellGeometry', hGrid[:cellGeometry])
54
+ end
55
+ end
56
+ if hGrid[:cellGeometry].nil?
57
+ @NameSpace.issueWarning(192, 'msr:cellGeometry', inContext)
58
+ end
59
+
60
+ # grid - transformation parameters availability (required)
61
+ @xml.tag!('msr:transformationParameterAvailability') do
62
+ @xml.tag!('gco:Boolean', hGrid[:transformationParameterAvailable])
63
+ end
64
+
65
+ end # writeXML
66
+ end # Grid class
67
+
68
+ end
69
+ end
70
+ end
71
+ end