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,71 @@
1
+ # GeoJSON Feature
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_geometryCollection'
15
+
16
+ module ADIWG
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19115_1
20
+
21
+ class Feature
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)
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
+ geoCollectionClass = GeometryCollection.new(@xml, @hResponseObj)
39
+
40
+ # feature - geometry object (required)
41
+ unless hGeoObject.empty?
42
+ id = hGeoObject[:id]
43
+ hProps = hGeoObject[:properties]
44
+ hGeometry = hGeoObject[:geometryObject]
45
+ case hGeometry[:type]
46
+ when 'Point'
47
+ pointClass.writeXML(hGeometry, hProps, id)
48
+ when 'LineString'
49
+ lineClass.writeXML(hGeometry, hProps, id)
50
+ when 'Polygon'
51
+ polyClass.writeXML(hGeometry, hProps, id)
52
+ when 'MultiPoint'
53
+ multiPointClass.writeXML(hGeometry, hProps, id)
54
+ when 'MultiLineString'
55
+ multiLineClass.writeXML(hGeometry, hProps, id)
56
+ when 'MultiPolygon'
57
+ multiPolyClass.writeXML(hGeometry, hProps, id)
58
+ when 'GeometryCollection'
59
+ geoCollectionClass.writeXML(hGeometry, hProps, id)
60
+ else
61
+ @NameSpace.issueNotice(140, "#{hGeometry[:type]}")
62
+ end
63
+ end
64
+
65
+ end # writeXML
66
+ end # Feature class
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,56 @@
1
+ # GeoJson FeatureCollection
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require_relative 'class_feature'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class FeatureCollection
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hGeoObject)
22
+
23
+ # classes used
24
+ featureClass = Feature.new(@xml, @hResponseObj)
25
+
26
+ # feature collection attributes
27
+ attributes = {}
28
+
29
+ # feature collection attributes - gml:id (required)
30
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
31
+ objId = 'featureCollection' + @hResponseObj[:writerMissingIdCount]
32
+ attributes['gml:id'] = objId
33
+
34
+ # feature collection attributes - srsName (GeoJSON is WGS84)
35
+ attributes[:srsName] = 'WGS84'
36
+
37
+ @xml.tag!('gml:MultiGeometry', attributes) do
38
+
39
+ # geometry collection - geometry objects (required)
40
+ @xml.tag!('gml:geometryMembers') do
41
+ unless hGeoObject[:features].empty?
42
+ aFeatures = hGeoObject[:features]
43
+ aFeatures.each do |hFeature|
44
+ featureClass.writeXML(hFeature)
45
+ end
46
+ end
47
+ end
48
+
49
+ end # gml:MultiGeometry tag
50
+ end # writeXML
51
+ end # FeatureCollection class
52
+
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,64 @@
1
+ # GeoJSON Feature Properties
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require_relative 'class_gmlIdentifier'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class FeatureProperties
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ end
20
+
21
+ def writeXML(hProperties)
22
+
23
+ # classes used
24
+ gmlId = GMLIdentifier.new(@xml, @hResponseObj)
25
+
26
+ unless hProperties.empty?
27
+
28
+ # feature properties - description
29
+ unless hProperties[:description].nil?
30
+ @xml.tag!('gml:description', hProperties[:description])
31
+ end
32
+ if hProperties[:description].nil? && @hResponseObj[:writerShowTags]
33
+ @xml.tag!('gml:description')
34
+ end
35
+
36
+ # feature properties - identifier [0]
37
+ unless hProperties[:identifiers].empty?
38
+ hId = hProperties[:identifiers][0]
39
+ gmlId.writeXML(hId)
40
+ end
41
+ if hProperties[:identifiers].empty? && @hResponseObj[:writerShowTags]
42
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
43
+ end
44
+
45
+ # feature properties - name []
46
+ hProperties[:featureNames].each do |name|
47
+ @xml.tag!('gml:name', name)
48
+ end
49
+ if hProperties[:featureNames].empty? && @hResponseObj[:writerShowTags]
50
+ @xml.tag!('gml:name')
51
+ end
52
+
53
+ # feature properties - featureScope - not supported
54
+ # feature properties - acquisitionMethod - not supported
55
+
56
+ end
57
+
58
+ end # writeXML
59
+ end # FeatureProperties class
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,74 @@
1
+ # ISO <<Class>> MD_Format
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-22 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_citation'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_Format
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(hFormat, inContext = nil)
24
+
25
+ # classes used
26
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'format'
29
+ outContext = inContext + ' format' unless inContext.nil?
30
+
31
+ @xml.tag!('mrd:MD_Format') do
32
+
33
+ # format - format specification citation {CI_Citation} (required)
34
+ unless hFormat[:formatSpecification].empty?
35
+ @xml.tag!('mrd:formatSpecificationCitation') do
36
+ citationClass.writeXML(hFormat[:formatSpecification], outContext)
37
+ end
38
+ end
39
+ if hFormat[:formatSpecification].empty?
40
+ @NameSpace.issueWarning(120, 'gmd:name', inContext)
41
+ end
42
+
43
+ # format - amendment number
44
+ unless hFormat[:amendmentNumber].nil?
45
+ @xml.tag!('mrd:amendmentNumber') do
46
+ @xml.tag!('gco:CharacterString', hFormat[:amendmentNumber])
47
+ end
48
+ end
49
+ if hFormat[:amendmentNumber].nil? && @hResponseObj[:writerShowTags]
50
+ @xml.tag!('mrd:amendmentNumber')
51
+ end
52
+
53
+ # format - file decompression method
54
+ unless hFormat[:compressionMethod].nil?
55
+ @xml.tag!('mrd:fileDecompressionTechnique') do
56
+ @xml.tag!('gco:CharacterString',hFormat[:compressionMethod])
57
+ end
58
+ end
59
+ if hFormat[:compressionMethod].nil? && @hResponseObj[:writerShowTags]
60
+ @xml.tag!('mrd:fileDecompressionTechnique')
61
+ end
62
+
63
+ # format - medium [] {MD_Medium} - not implemented in MD_Format
64
+
65
+ # format - distributor [] {MD_Distributor} - not implemented in MD_Format
66
+
67
+ end # MD_Format tag
68
+ end # writeXML
69
+ end # MD_Format class
70
+
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,46 @@
1
+ # ISO <<Class>> MD_RepresentativeFraction
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-21 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class MD_RepresentativeFraction
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
20
+ end
21
+
22
+ def writeXML(denominator, inContext = nil)
23
+
24
+ outContext = 'scale factor'
25
+ outContext = inContext + ' scale factor' unless inContext.nil?
26
+
27
+ @xml.tag!('mri:MD_RepresentativeFraction') do
28
+
29
+ # representative fraction - denominator
30
+ unless denominator.nil?
31
+ @xml.tag!('mri:denominator') do
32
+ @xml.tag!('gco:Integer', denominator)
33
+ end
34
+ end
35
+ if denominator.nil?
36
+ @NameSpace.issueWarning(120, 'mri:denominator', outContext)
37
+ end
38
+
39
+ end # gmd:MD_RepresentativeFraction tag
40
+ end # writeXML
41
+ end # MD_RepresentativeFraction class
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ # ISO <<Class>> Date, DateTime
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-14 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class GcoDateTime
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hDate)
20
+
21
+ date = hDate[:date]
22
+ dateRes = hDate[:dateResolution]
23
+
24
+ # date - date (required)
25
+ unless date.nil?
26
+ case dateRes
27
+ when 'Y', 'YM', 'YMD', 'YMDh', 'YMDhm', 'YMDhms'
28
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, 'YMDhms')
29
+ @xml.tag!('gco:DateTime', dateStr)
30
+ when 'YMDhZ', 'YMDhmZ', 'YMDhmsZ'
31
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, 'YMDhmsZ')
32
+ @xml.tag!('gco:DateTime', dateStr)
33
+ else
34
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateRes)
35
+ @xml.tag!('gco:DateTime', dateStr)
36
+ end
37
+ end
38
+
39
+ end # write XML
40
+ end # Date class
41
+
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,77 @@
1
+ # ISO <<Class>> geographicElement {abstract}
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-19 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_geometryCollection'
15
+ require_relative 'class_feature'
16
+ require_relative 'class_featureCollection'
17
+
18
+ module ADIWG
19
+ module Mdtranslator
20
+ module Writers
21
+ module Iso19115_1
22
+
23
+ class GeographicElement
24
+
25
+ def initialize(xml, hResponseObj)
26
+ @xml = xml
27
+ @hResponseObj = hResponseObj
28
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
29
+ end
30
+
31
+ def writeXML(aGeoElement)
32
+
33
+ # classes used
34
+ pointClass = Point.new(@xml, @hResponseObj)
35
+ lineClass = LineString.new(@xml, @hResponseObj)
36
+ polyClass = Polygon.new(@xml, @hResponseObj)
37
+ multiPointClass = MultiPoint.new(@xml, @hResponseObj)
38
+ multiLineClass = MultiLineString.new(@xml, @hResponseObj)
39
+ multiPolyClass = MultiPolygon.new(@xml, @hResponseObj)
40
+ geoCollectClass = GeometryCollection.new(@xml, @hResponseObj)
41
+ featureClass = Feature.new(@xml, @hResponseObj)
42
+ featureCollectClass = FeatureCollection.new(@xml, @hResponseObj)
43
+
44
+ aGeoElement.each do |hGeoElement|
45
+ @xml.tag!('gex:polygon') do
46
+ case hGeoElement[:type]
47
+ when 'Point'
48
+ pointClass.writeXML(hGeoElement, {}, nil)
49
+ when 'LineString'
50
+ lineClass.writeXML(hGeoElement, {}, nil)
51
+ when 'Polygon'
52
+ polyClass.writeXML(hGeoElement, {}, nil)
53
+ when 'MultiPoint'
54
+ multiPointClass.writeXML(hGeoElement, {}, nil)
55
+ when 'MultiLineString'
56
+ multiLineClass.writeXML(hGeoElement, {}, nil)
57
+ when 'MultiPolygon'
58
+ multiPolyClass.writeXML(hGeoElement, {}, nil)
59
+ when 'GeometryCollection'
60
+ geoCollectClass.writeXML(hGeoElement, {}, nil)
61
+ when 'Feature'
62
+ featureClass.writeXML(hGeoElement)
63
+ when 'FeatureCollection'
64
+ featureCollectClass.writeXML(hGeoElement)
65
+ else
66
+ @NameSpace.issueNotice(110, "#{hGeoElement[:type]}")
67
+ end
68
+ end
69
+ end
70
+
71
+ end # writeXML
72
+ end # GeographicElement class
73
+
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,96 @@
1
+ # ISO <<Class>> geographicElement {abstract}
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-19 original script
6
+
7
+ require_relative 'class_boundingBox'
8
+ require_relative 'class_identifier'
9
+ require_relative 'class_geographicElement'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class GeographicExtent
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ end
22
+
23
+ def writeXML(hGeoExtent)
24
+
25
+ # classes used
26
+ bBoxClass = EX_GeographicBoundingBox.new(@xml, @hResponseObj)
27
+ idClass = MD_Identifier.new(@xml, @hResponseObj)
28
+ geoEleClass = GeographicElement.new(@xml, @hResponseObj)
29
+
30
+ extType = hGeoExtent[:containsData]
31
+
32
+ # geographic element - geographic bounding box
33
+ # test for user provided bounding box
34
+ # if empty, use computedBbox
35
+ hBbox = hGeoExtent[:boundingBox]
36
+ if hBbox.empty?
37
+ hBbox = hGeoExtent[:computedBbox]
38
+ end
39
+ unless hBbox.empty?
40
+ @xml.tag!('gex:geographicElement') do
41
+ @xml.tag!('gex:EX_GeographicBoundingBox') do
42
+
43
+ # geographic bounding box - extent type {Boolean}
44
+ @xml.tag!('gex:extentTypeCode') do
45
+ @xml.tag!('gco:Boolean', extType)
46
+ end
47
+
48
+ # geographic bounding box - bounding box
49
+ bBoxClass.writeXML(hBbox)
50
+ end
51
+ end
52
+ end
53
+
54
+ # geographic element - geographic description
55
+ unless hGeoExtent[:identifier].empty?
56
+ @xml.tag!('gex:geographicElement') do
57
+ @xml.tag!('gex:EX_GeographicDescription') do
58
+
59
+ # geographic description - extent type {Boolean}
60
+ @xml.tag!('gex:extentTypeCode') do
61
+ @xml.tag!('gco:Boolean', extType)
62
+ end
63
+
64
+ # geographic description - geographic identifier {MD_Identifier}
65
+ @xml.tag!('gex:geographicIdentifier') do
66
+ idClass.writeXML(hGeoExtent[:identifier], 'geographic extent')
67
+ end
68
+
69
+ end
70
+ end
71
+ end
72
+
73
+ # geographic element - geographic bounding polygon
74
+ unless hGeoExtent[:geographicElements].empty?
75
+ @xml.tag!('gex:geographicElement') do
76
+ @xml.tag!('gex:EX_BoundingPolygon') do
77
+
78
+ # bounding polygon - extent type {Boolean}
79
+ @xml.tag!('gex:extentTypeCode') do
80
+ @xml.tag!('gco:Boolean', extType)
81
+ end
82
+
83
+ # bounding polygon - geographic elements {GeoJSON}
84
+ geoEleClass.writeXML(hGeoExtent[:geographicElements])
85
+
86
+ end
87
+ end
88
+ end
89
+
90
+ end # writeXML
91
+ end # GeographicExtent class
92
+
93
+ end
94
+ end
95
+ end
96
+ end