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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
- data/lib/adiwg/mdtranslator/version.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
- data/lib/adiwg/mdtranslator_cli.rb +21 -4
- metadata +6 -5
@@ -2,83 +2,83 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2016-12-05 original script
|
6
6
|
|
7
7
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
8
8
|
require_relative 'class_point'
|
9
9
|
require_relative 'class_featureProperties'
|
10
10
|
|
11
11
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Iso19115_2
|
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
|
40
74
|
end
|
41
|
-
|
75
|
+
end
|
42
76
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
attributes[:srsDimension] = s
|
47
|
-
end
|
77
|
+
end # gml:Point tag
|
78
|
+
end # writeXML
|
79
|
+
end # multiPoint class
|
48
80
|
|
49
|
-
|
50
|
-
|
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
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
84
|
end
|
@@ -2,83 +2,83 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2016-12-06 original script
|
6
6
|
|
7
7
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
8
8
|
require_relative 'class_polygon'
|
9
9
|
require_relative 'class_featureProperties'
|
10
10
|
|
11
11
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Iso19115_2
|
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
|
40
74
|
end
|
41
|
-
|
75
|
+
end
|
42
76
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
attributes[:srsDimension] = s
|
47
|
-
end
|
77
|
+
end # gml:MultiGeometry tag
|
78
|
+
end # writeXML
|
79
|
+
end # MultiPolygon class
|
48
80
|
|
49
|
-
|
50
|
-
|
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
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
84
|
end
|
@@ -2,97 +2,100 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
5
|
+
# Stan Smith 2018-04-10 add error and warning messaging
|
6
|
+
# Stan Smith 2016-11-18 refactored for mdTranslator/mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
8
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-08-14 added protocol to onlineResource
|
13
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
13
14
|
# Stan Smith 2013-08-14 original script.
|
14
15
|
|
16
|
+
require_relative '../iso19115_2_writer'
|
15
17
|
require_relative 'class_codelist'
|
16
18
|
|
17
19
|
module ADIWG
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19115_2
|
21
23
|
|
22
|
-
|
24
|
+
class CI_OnlineResource
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def initialize(xml, hResponseObj)
|
27
|
+
@xml = xml
|
28
|
+
@hResponseObj = hResponseObj
|
29
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
30
|
+
end
|
28
31
|
|
29
|
-
|
32
|
+
def writeXML(hOlResource, inContext = nil)
|
30
33
|
|
31
|
-
|
32
|
-
|
34
|
+
# classes used
|
35
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
33
36
|
|
34
|
-
|
37
|
+
@xml.tag! 'gmd:CI_OnlineResource' do
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
# online resource - link - required
|
40
|
+
s = hOlResource[:olResURI]
|
41
|
+
unless s.nil?
|
42
|
+
@xml.tag!('gmd:linkage') do
|
43
|
+
@xml.tag!('gmd:URL', s)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
if s.nil?
|
47
|
+
@NameSpace.issueWarning(250, 'gmd:linkage', inContext)
|
48
|
+
end
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
# online resource - protocol
|
51
|
+
s = hOlResource[:olResProtocol]
|
52
|
+
unless s.nil?
|
53
|
+
@xml.tag!('gmd:protocol') do
|
54
|
+
@xml.tag!('gco:CharacterString', s)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
58
|
+
@xml.tag!('gmd:protocol')
|
59
|
+
end
|
57
60
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
# online resource - link name
|
62
|
+
s = hOlResource[:olResName]
|
63
|
+
unless s.nil?
|
64
|
+
@xml.tag!('gmd:name') do
|
65
|
+
@xml.tag!('gco:CharacterString', s)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
69
|
+
@xml.tag!('gmd:name')
|
70
|
+
end
|
68
71
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
# online resource - link description
|
73
|
+
s = hOlResource[:olResDesc]
|
74
|
+
unless s.nil?
|
75
|
+
@xml.tag!('gmd:description') do
|
76
|
+
@xml.tag!('gco:CharacterString', s)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
80
|
+
@xml.tag!('gmd:description')
|
81
|
+
end
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
# online resource - link function {CI_OnLineFunctionCode}
|
84
|
+
s = hOlResource[:olResFunction]
|
85
|
+
unless s.nil?
|
86
|
+
@xml.tag!('gmd:function') do
|
87
|
+
codelistClass.writeXML('gmd', 'iso_onlineFunction', s)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
91
|
+
@xml.tag!('gmd:function')
|
92
|
+
end
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
+
end # CI_OnlineResource tag
|
95
|
+
end # write XML
|
96
|
+
end # CI_OnlineResource class
|
94
97
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
98
101
|
end
|