adiwg-mdtranslator 2.10.0 → 2.12.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +23 -24
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +4 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +13 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +38 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +5 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +17 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +24 -5
- data/lib/adiwg/mdtranslator/version.rb +8 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +10 -10
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +21 -16
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb +8 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +11 -11
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb +6 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +14 -14
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb +18 -18
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +10 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +10 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb +7 -9
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb +7 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb +9 -5
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb +15 -11
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb +7 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +8 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +22 -18
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +32 -12
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +17 -6
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/{class_mapProjection.rb → class_mapProjectionTags.rb} +33 -57
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb +9 -12
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +7 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +16 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb +24 -19
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb +7 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb +8 -5
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +6 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +146 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +168 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +42 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +294 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +47 -328
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +6 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_security.rb +5 -6
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +11 -14
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +22 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +8 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyClassification.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +17 -10
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +11 -15
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +9 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +11 -17
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +53 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +213 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_allocation.rb +13 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +10 -10
- data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomyClass.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_baseUnit.rb +27 -27
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_codelist.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_contact.rb +79 -79
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_conventionalUnit.rb +49 -49
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionUnit.rb +24 -24
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_derivedUnit.rb +36 -36
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +28 -21
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +12 -9
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +8 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +7 -4
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_locale.rb +52 -49
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +4 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_onlineResource.rb +79 -76
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_phone.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_responsibleParty.rb +117 -108
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb +246 -246
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +44 -6
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +40 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +13 -6
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_allocation.rb +3 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_resourceInfo.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomicClassification.rb +6 -4
- data/lib/adiwg/mdtranslator_cli.rb +18 -8
- metadata +14 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +0 -167
@@ -2,56 +2,56 @@
|
|
2
2
|
|
3
3
|
# from http://mdtranslator.adiwg.org/api/codelists?format=xml
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
5
|
+
# Stan Smith 2016-11-19 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2015-06-11 refactored to use mdCodes gem for codelist contents
|
10
|
+
# Stan Smith 2014-12-15 replaced NOAA CT_CodelistCatalogue with mdTranslator CT_CodelistCatalogue
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-10-15 allow non-ISO codesNames to be rendered
|
13
13
|
# Stan Smith 2013-08-09 original script
|
14
14
|
|
15
15
|
require 'adiwg-mdcodes'
|
16
16
|
|
17
17
|
module ADIWG
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
module Mdtranslator
|
19
|
+
module Writers
|
20
|
+
module Iso19110
|
21
21
|
|
22
|
-
|
22
|
+
class MD_Codelist
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def initialize(xml, hResponseObj)
|
25
|
+
@xml = xml
|
26
|
+
@hResponseObj = hResponseObj
|
27
|
+
end
|
28
28
|
|
29
|
-
|
29
|
+
def writeXML(codeSpace, codeList, codeName)
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
# get requested codelist from the adiwg-mdcodes gem
|
32
|
+
mdCodelist = ADIWG::Mdcodes.getCodelistDetail(codeList, @hResponseObj)
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
sourceName = mdCodelist['sourceName']
|
35
|
+
codelist = mdCodelist['codelist']
|
36
|
+
codeId = 'userCode'
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
# search the codelist for a matching codeName
|
39
|
+
codelist.each do |code|
|
40
|
+
if code['codeName'] == codeName
|
41
|
+
codeId = code['code']
|
42
|
+
break
|
43
|
+
end
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
46
|
+
# generate the iso code block
|
47
|
+
@xml.tag!(codeSpace + ':' + "#{sourceName}", {:codeList => 'http://mdtranslator.adiwg.org/api/codelists?format=xml#' + "#{sourceName}",
|
48
|
+
:codeListValue => "#{codeName}",
|
49
|
+
:codeSpace => "#{codeId}"})
|
50
|
+
end
|
53
51
|
|
54
52
|
end
|
55
|
-
|
56
|
-
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
57
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
# 19110 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
5
|
+
# Stan Smith 2017-01-23 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
11
|
+
# Stan Smith 2014-05-16 added method to return contact from array
|
12
|
+
# Stan Smith 2014-05-14 modified for JSON schema version 0.4.0
|
13
13
|
# Stan Smith 2013-08-12 original script
|
14
14
|
|
15
15
|
require_relative 'class_phone'
|
@@ -17,87 +17,87 @@ require_relative 'class_address'
|
|
17
17
|
require_relative 'class_onlineResource'
|
18
18
|
|
19
19
|
module ADIWG
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19110
|
23
23
|
|
24
|
-
|
24
|
+
class CI_Contact
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def initialize(xml, hResponseObj)
|
27
|
+
@xml = xml
|
28
|
+
@hResponseObj = hResponseObj
|
29
|
+
end
|
30
30
|
|
31
|
-
|
31
|
+
def writeXML(hContact)
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
# classes used
|
34
|
+
phoneClass = CI_Telephone.new(@xml, @hResponseObj)
|
35
|
+
addClass = CI_Address.new(@xml, @hResponseObj)
|
36
|
+
resourceClass = CI_OnlineResource.new(@xml, @hResponseObj)
|
37
37
|
|
38
|
-
|
38
|
+
@xml.tag!('gmd:CI_Contact') do
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
# contact - phones [] (pass all phones)
|
41
|
+
aPhones = hContact[:phones]
|
42
|
+
unless aPhones.empty?
|
43
|
+
@xml.tag!('gmd:phone') do
|
44
|
+
phoneClass.writeXML(aPhones)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
if aPhones.empty? && @hResponseObj[:writerShowTags]
|
48
|
+
@xml.tag!('gmd:phone')
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
# contact - address [0]
|
52
|
+
hAddress = hContact[:addresses][0]
|
53
|
+
aEmail = hContact[:eMailList]
|
54
|
+
unless hAddress.nil? && aEmail.empty?
|
55
|
+
@xml.tag!('gmd:address') do
|
56
|
+
addClass.writeXML(hAddress, aEmail)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
if hAddress.nil? && hContact[:eMailList].empty? && @hResponseObj[:writerShowTags]
|
60
|
+
@xml.tag!('gmd:address')
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
# contact - online resource [0]
|
64
|
+
hOlResource = hContact[:onlineResources][0]
|
65
|
+
unless hOlResource.nil?
|
66
|
+
@xml.tag!('gmd:onlineResource') do
|
67
|
+
resourceClass.writeXML(hOlResource)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
if hOlResource.nil? && @hResponseObj[:writerShowTags]
|
71
|
+
@xml.tag!('gmd:onlineResource')
|
72
|
+
end
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
# contact - hours of service [0]
|
75
|
+
s = hContact[:hoursOfService][0]
|
76
|
+
unless s.nil?
|
77
|
+
@xml.tag!('gmd:hoursOfService') do
|
78
|
+
@xml.tag!('gco:CharacterString', s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
82
|
+
@xml.tag!('gmd:hoursOfService')
|
83
|
+
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
85
|
+
# contact - contact instructions
|
86
|
+
s = hContact[:contactInstructions]
|
87
|
+
unless s.nil?
|
88
|
+
@xml.tag!('gmd:contactInstructions') do
|
89
|
+
@xml.tag!('gco:CharacterString', hContact[:contactInstructions])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
93
|
+
@xml.tag!('gmd:contactInstructions')
|
94
|
+
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
end # CI_Contact tag
|
97
|
+
end # write XML
|
98
|
+
end # CI_Contact class
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
103
|
end
|
@@ -2,67 +2,67 @@
|
|
2
2
|
# writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
6
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
7
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
5
9
|
# Stan Smith 2014-12-03 original script
|
6
|
-
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
7
|
-
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
-
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
-
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
10
10
|
|
11
11
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Iso19110
|
15
15
|
|
16
|
-
|
16
|
+
class ConventionalUnit
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
def initialize(xml, responseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = responseObj
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
def writeXML(hConv)
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
# create and identity for the unit
|
26
|
+
@hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
|
27
|
+
unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
@xml.tag!('gml:ConventionalUnit', {'gml:id' => unitID}) do
|
30
|
+
@xml.tag!('gml:identifier', {'codeSpace' => hConv[:codeSpace]}, hConv[:identifier])
|
31
|
+
@xml.tag!('gml:name', hConv[:name])
|
32
|
+
@xml.tag!('gml:catalogSymbol', hConv[:catalogSymbol])
|
33
|
+
@xml.tag!('gml:conversionToPreferredUnit', {'uom' => hConv[:preferredUnit]}) do
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
35
|
+
# two methods of conversion are available
|
36
|
+
# factor and formula
|
37
|
+
if !hConv[:factor].nil?
|
38
|
+
# factor:
|
39
|
+
# y = factor * x
|
40
|
+
# y is in preferred units
|
41
|
+
# x is in provided units
|
42
|
+
# factor is conversion to preferred units
|
43
|
+
@xml.tag!('gml:factor', hConv[:factor])
|
44
|
+
else
|
45
|
+
# formula:
|
46
|
+
# y = (a + bx) / (c + dx)
|
47
|
+
# y is in preferred units
|
48
|
+
# x is in provided units
|
49
|
+
# a,b,c,d are constants to convert to preferred units
|
50
|
+
@xml.tag!('gml:formula') do
|
51
|
+
@xml.tag!('gml:a', hConv[:a])
|
52
|
+
@xml.tag!('gml:b', hConv[:b])
|
53
|
+
@xml.tag!('gml:c', hConv[:c])
|
54
|
+
@xml.tag!('gml:d', hConv[:d])
|
55
|
+
end
|
59
56
|
end
|
60
57
|
|
61
|
-
|
58
|
+
end
|
59
|
+
end
|
62
60
|
|
63
|
-
|
61
|
+
end
|
64
62
|
|
65
63
|
end
|
66
|
-
|
67
|
-
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
68
|
end
|
@@ -2,8 +2,10 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-04-03 refactored error and warning messaging
|
5
6
|
# Stan Smith 2017-11-02 original script
|
6
7
|
|
8
|
+
require_relative '../iso19110_writer'
|
7
9
|
require_relative 'class_codelist'
|
8
10
|
require_relative 'class_gcoDateTime'
|
9
11
|
|
@@ -17,6 +19,7 @@ module ADIWG
|
|
17
19
|
def initialize(xml, hResponseObj)
|
18
20
|
@xml = xml
|
19
21
|
@hResponseObj = hResponseObj
|
22
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
|
20
23
|
end
|
21
24
|
|
22
25
|
def writeXML(hDate)
|
@@ -37,7 +40,7 @@ module ADIWG
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
if date.nil?
|
40
|
-
@
|
43
|
+
@NameSpace.issueError(30)
|
41
44
|
end
|
42
45
|
|
43
46
|
# date - date type (required)
|
@@ -47,7 +50,7 @@ module ADIWG
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
if dateType.nil?
|
50
|
-
@
|
53
|
+
@NameSpace.issueWarning(31, 'gmd:dateType')
|
51
54
|
end
|
52
55
|
|
53
56
|
end # CI_Date tag
|
@@ -2,38 +2,38 @@
|
|
2
2
|
# writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
6
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
7
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
5
9
|
# Stan Smith 2014-12-03 original script
|
6
|
-
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
7
|
-
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
-
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
-
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
10
10
|
|
11
11
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Iso19110
|
15
15
|
|
16
|
-
|
16
|
+
class UnitDefinition
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
def initialize(xml, responseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = responseObj
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
def writeXML(unit)
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
# create an identity for the unit
|
26
|
+
@hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
|
27
|
+
unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
|
28
|
+
@xml.tag!('gml:UnitDefinition', {'gml:id' => unitID}) do
|
29
|
+
@xml.tag!('gml:identifier', {'codeSpace' => ''}, unit)
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
end
|
32
|
+
end
|
35
33
|
|
36
34
|
end
|
37
|
-
|
38
|
-
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
39
|
end
|
@@ -2,45 +2,45 @@
|
|
2
2
|
# writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
6
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
7
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
5
9
|
# Stan Smith 2014-12-03 original script
|
6
|
-
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
7
|
-
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
8
|
-
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
-
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
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
|
-
|
40
|
-
|
41
|
-
end
|
12
|
+
module Mdtranslator
|
13
|
+
module Writers
|
14
|
+
module Iso19110
|
15
|
+
|
16
|
+
class DerivedUnit
|
17
|
+
|
18
|
+
def initialize(xml, responseObj)
|
19
|
+
@xml = xml
|
20
|
+
@hResponseObj = responseObj
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(hDerived)
|
24
|
+
|
25
|
+
# create and identity for the unit
|
26
|
+
@hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
|
27
|
+
unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
|
28
|
+
@xml.tag!('gml:DerivedUnit', {'gml:id' => unitID}) do
|
29
|
+
@xml.tag!('gml:identifier', {'codeSpace' => hDerived[:codeSpace]}, hDerived[:identifier])
|
30
|
+
@xml.tag!('gml:name', hDerived[:name])
|
31
|
+
@xml.tag!('gml:remarks', hDerived[:remarks])
|
32
|
+
@xml.tag!('gml:catalogSymbol', hDerived[:catalogSymbol])
|
33
|
+
aTerms = hDerived[:derivationUnitTerm]
|
34
|
+
aTerms.each do |term|
|
35
|
+
@xml.tag!('gml:derivationUnitTerm', term)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
42
40
|
|
43
41
|
end
|
44
|
-
|
45
|
-
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
46
|
end
|