adiwg-mdtranslator 2.7.0 → 2.8.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 +18 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +12 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +12 -113
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +9 -27
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +27 -15
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalSystem.rb → module_mapLocalPlanar.rb} +3 -14
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +4 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_verticalReference.rb → module_verticalDatum.rb} +0 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +4 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +95 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +1 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +29 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +8 -23
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +2 -2
- data/lib/adiwg/mdtranslator/version.rb +4 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +6 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +18 -5
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +56 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +45 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +167 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjection.rb +374 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +372 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +134 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +8 -11
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +120 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +12 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +85 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +36 -15
- data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +1 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +7 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +21 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +332 -321
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +34 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReference.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReferenceParameters.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +1 -1
- metadata +20 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_ellipsoid.rb +0 -78
- data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +0 -68
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_ellipsoidParameters.rb +0 -32
@@ -24,17 +24,38 @@ module ADIWG
|
|
24
24
|
identifierClass = Html_Identifier.new(@html)
|
25
25
|
linePointClass = Html_ObliqueLinePoint.new()
|
26
26
|
|
27
|
-
# projection parameters -
|
28
|
-
unless hProjection[:
|
29
|
-
@html.em('
|
30
|
-
@html.text!(hProjection[:
|
27
|
+
# projection parameters - grid system
|
28
|
+
unless hProjection[:gridSystem].nil?
|
29
|
+
@html.em('Grid System: ')
|
30
|
+
@html.text!(hProjection[:gridSystem])
|
31
|
+
@html.br
|
32
|
+
end
|
33
|
+
|
34
|
+
# projection parameters - grid system name
|
35
|
+
unless hProjection[:gridSystemName].nil?
|
36
|
+
@html.em('Grid System Name: ')
|
37
|
+
@html.text!(hProjection[:gridSystemName])
|
31
38
|
@html.br
|
32
39
|
end
|
33
40
|
|
34
41
|
# projection parameters - zone
|
35
|
-
unless hProjection[:
|
36
|
-
@html.em('
|
37
|
-
@html.text!(hProjection[:
|
42
|
+
unless hProjection[:gridZone].nil?
|
43
|
+
@html.em('Grid System Zone: ')
|
44
|
+
@html.text!(hProjection[:gridZone])
|
45
|
+
@html.br
|
46
|
+
end
|
47
|
+
|
48
|
+
# projection parameters - projection
|
49
|
+
unless hProjection[:projection].nil?
|
50
|
+
@html.em('Projection: ')
|
51
|
+
@html.text!(hProjection[:projection])
|
52
|
+
@html.br
|
53
|
+
end
|
54
|
+
|
55
|
+
# projection parameters - projection name
|
56
|
+
unless hProjection[:projectionName].nil?
|
57
|
+
@html.em('Projection Name: ')
|
58
|
+
@html.text!(hProjection[:projectionName])
|
38
59
|
@html.br
|
39
60
|
end
|
40
61
|
|
@@ -194,14 +215,6 @@ module ADIWG
|
|
194
215
|
end
|
195
216
|
end
|
196
217
|
|
197
|
-
# projection parameters - other projection description
|
198
|
-
unless hProjection[:otherProjectionDescription].nil?
|
199
|
-
@html.em('Other Projection Description: ')
|
200
|
-
@html.section(:class => 'block') do
|
201
|
-
@html.text!(hProjection[:otherProjectionDescription])
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
218
|
# projection parameters - other grid description
|
206
219
|
unless hProjection[:otherGridDescription].nil?
|
207
220
|
@html.em('Other Grid Description: ')
|
@@ -210,6 +223,14 @@ module ADIWG
|
|
210
223
|
end
|
211
224
|
end
|
212
225
|
|
226
|
+
# projection parameters - other projection description
|
227
|
+
unless hProjection[:otherProjectionDescription].nil?
|
228
|
+
@html.em('Other Projection Description: ')
|
229
|
+
@html.section(:class => 'block') do
|
230
|
+
@html.text!(hProjection[:otherProjectionDescription])
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
213
234
|
# projection parameters - projection identifier
|
214
235
|
unless hProjection[:projectionIdentifier].empty?
|
215
236
|
@html.details do
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Stan Smith 2017-10-24 original script
|
6
6
|
|
7
7
|
require_relative 'html_projectionParameters'
|
8
|
-
require_relative '
|
8
|
+
require_relative 'html_geodeticParameters'
|
9
9
|
require_relative 'html_verticalDatumParameters'
|
10
10
|
|
11
11
|
module ADIWG
|
@@ -23,7 +23,7 @@ module ADIWG
|
|
23
23
|
|
24
24
|
# classes used
|
25
25
|
projectionClass = Html_ProjectionParameters.new(@html)
|
26
|
-
ellipsoidClass =
|
26
|
+
ellipsoidClass = Html_GeodeticParameters.new(@html)
|
27
27
|
verticalClass = Html_VerticalDatumParameters.new(@html)
|
28
28
|
|
29
29
|
# reference parameter set - projection
|
@@ -36,12 +36,12 @@ module ADIWG
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
# reference parameter set -
|
40
|
-
unless hParamSet[:
|
39
|
+
# reference parameter set - geodetic
|
40
|
+
unless hParamSet[:geodetic].empty?
|
41
41
|
@html.details do
|
42
|
-
@html.summary('
|
42
|
+
@html.summary('Geodetic Parameters', {'id' => 'geodetic', 'class' => 'h5'})
|
43
43
|
@html.section(:class => 'block') do
|
44
|
-
ellipsoidClass.writeHtml(hParamSet[:
|
44
|
+
ellipsoidClass.writeHtml(hParamSet[:geodetic])
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -321,8 +321,7 @@ module ADIWG
|
|
321
321
|
end
|
322
322
|
|
323
323
|
# resource - keywords [] {keyword}
|
324
|
-
unless hResource[:
|
325
|
-
hResource[:keywords].empty?
|
324
|
+
unless hResource[:keywords].empty?
|
326
325
|
@html.details do
|
327
326
|
@html.summary('Keywords', {'id' => 'resourceInfo-keyword', 'class' => 'h3'})
|
328
327
|
@html.section(:class => 'block') do
|
@@ -30,6 +30,13 @@ module ADIWG
|
|
30
30
|
end
|
31
31
|
@html.br
|
32
32
|
|
33
|
+
# vertical datum - datum name
|
34
|
+
unless hDatum[:datumName].nil?
|
35
|
+
@html.em('Datum Name: ')
|
36
|
+
@html.text!(hDatum[:datumName])
|
37
|
+
@html.br
|
38
|
+
end
|
39
|
+
|
33
40
|
# vertical datum - encoding method
|
34
41
|
unless hDatum[:encodingMethod].nil?
|
35
42
|
@html.em('Encoding Method: ')
|
@@ -41,39 +41,52 @@ module ADIWG
|
|
41
41
|
@xml.tag!('gmd:projection')
|
42
42
|
end
|
43
43
|
|
44
|
-
# ellipsoid identifier {rsIdentifier}
|
45
|
-
unless hParamSet[:
|
46
|
-
hIdentifier = hParamSet[:
|
44
|
+
# geodetic ellipsoid identifier {rsIdentifier}
|
45
|
+
unless hParamSet[:geodetic].empty?
|
46
|
+
hIdentifier = hParamSet[:geodetic][:ellipsoidIdentifier]
|
47
47
|
unless hIdentifier.empty?
|
48
48
|
@xml.tag!('gmd:ellipsoid') do
|
49
49
|
idClass.writeXML(hIdentifier)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
if hParamSet[:
|
53
|
+
if hParamSet[:geodetic].empty? && @hResponseObj[:writerShowTags]
|
54
54
|
@xml.tag!('gmd:ellipsoid')
|
55
55
|
end
|
56
56
|
|
57
|
+
haveDatum = false
|
58
|
+
# geodetic datum identifier {rsIdentifier}
|
59
|
+
unless hParamSet[:geodetic].empty?
|
60
|
+
hIdentifier = hParamSet[:geodetic][:datumIdentifier]
|
61
|
+
unless hIdentifier.empty?
|
62
|
+
@xml.tag!('gmd:datum') do
|
63
|
+
idClass.writeXML(hIdentifier)
|
64
|
+
haveDatum = true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
57
69
|
# vertical datum identifier {rsIdentifier}
|
58
70
|
unless hParamSet[:verticalDatum].empty?
|
59
71
|
hIdentifier = hParamSet[:verticalDatum][:datumIdentifier]
|
60
72
|
unless hIdentifier.empty?
|
61
73
|
@xml.tag!('gmd:datum') do
|
62
74
|
idClass.writeXML(hIdentifier)
|
75
|
+
haveDatum = true
|
63
76
|
end
|
64
77
|
end
|
65
78
|
end
|
66
|
-
if
|
79
|
+
if !haveDatum && @hResponseObj[:writerShowTags]
|
67
80
|
@xml.tag!('gmd:datum')
|
68
81
|
end
|
69
82
|
|
70
83
|
# ellipsoid parameters
|
71
|
-
unless hParamSet[:
|
84
|
+
unless hParamSet[:geodetic].empty?
|
72
85
|
@xml.tag!('gmd:ellipsoidParameters') do
|
73
|
-
ellipsoidClass.writeXML(hParamSet[:
|
86
|
+
ellipsoidClass.writeXML(hParamSet[:geodetic])
|
74
87
|
end
|
75
88
|
end
|
76
|
-
if hParamSet[:
|
89
|
+
if hParamSet[:geodetic].empty? && @hResponseObj[:writerShowTags]
|
77
90
|
@xml.tag!('gmd:ellipsoidParameters')
|
78
91
|
end
|
79
92
|
|
@@ -2,19 +2,21 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
5
|
+
# Stan Smith 2018-01-05 deprecated topicCategory[]
|
6
|
+
# Stan Smith 2018-01-05 get topics from keywords where type='isoTopicCategory'
|
7
|
+
# Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
|
8
|
+
# Stan Smith 2015-07-30 added support for translating locale into language and characterSet
|
9
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
10
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
11
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
12
|
+
# Stan Smith 2015-06-12 added support for declaring multiple resource character sets
|
13
|
+
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
14
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
15
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
16
|
+
# Stan Smith 2014-10-29 add resource time period as a extent temporal element
|
17
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
18
|
+
# Stan Smith 2014-05-21 added aggregate information section
|
19
|
+
# Stan Smith 2014-05-15 modify to support JSON schema version 0.4.0
|
18
20
|
# Stan Smith 2013-11-25 add spatial resolution
|
19
21
|
# Stan Smith 2013-11-25 add resource usage
|
20
22
|
# Stan Smith 2013-11-22 add metadata extension
|
@@ -42,312 +44,321 @@ require_relative 'class_resolution'
|
|
42
44
|
require_relative 'class_extent'
|
43
45
|
|
44
46
|
module ADIWG
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
47
|
+
module Mdtranslator
|
48
|
+
module Writers
|
49
|
+
module Iso19115_2
|
50
|
+
|
51
|
+
class MD_DataIdentification
|
52
|
+
|
53
|
+
def initialize(xml, hResponseObj)
|
54
|
+
@xml = xml
|
55
|
+
@hResponseObj = hResponseObj
|
56
|
+
end
|
57
|
+
|
58
|
+
def writeXML(hData, aAssocRes)
|
59
|
+
|
60
|
+
# classes used
|
61
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
62
|
+
enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
|
63
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
64
|
+
rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
|
65
|
+
mInfoClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
|
66
|
+
bGraphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
|
67
|
+
rFormatClass = MD_Format.new(@xml, @hResponseObj)
|
68
|
+
keywordClass = MD_Keywords.new(@xml, @hResponseObj)
|
69
|
+
useClass = MD_Usage.new(@xml, @hResponseObj)
|
70
|
+
uConClass = MD_Constraints.new(@xml, @hResponseObj)
|
71
|
+
lConClass = MD_LegalConstraints.new(@xml, @hResponseObj)
|
72
|
+
sConClass = MD_SecurityConstraints.new(@xml, @hResponseObj)
|
73
|
+
aggInfoClass = MD_AggregateInformation.new(@xml, @hResponseObj)
|
74
|
+
taxClass = MD_TaxonSys.new(@xml, @hResponseObj)
|
75
|
+
resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
|
76
|
+
extentClass = EX_Extent.new(@xml, @hResponseObj)
|
77
|
+
|
78
|
+
# data identification
|
79
|
+
@xml.tag!('gmd:MD_DataIdentification') do
|
80
|
+
|
81
|
+
# data identification - citation {CI_Citation} (required)
|
82
|
+
hCitation = hData[:citation]
|
83
|
+
unless hCitation.empty?
|
84
|
+
@xml.tag!('gmd:citation') do
|
85
|
+
citationClass.writeXML(hCitation)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
if hCitation.empty?
|
89
|
+
@xml.tag!('gmd:citation', {'gco:nilReason' => 'missing'})
|
90
|
+
end
|
91
|
+
|
92
|
+
# data identification - abstract (required)
|
93
|
+
s = hData[:abstract]
|
94
|
+
unless s.nil?
|
95
|
+
@xml.tag!('gmd:abstract') do
|
96
|
+
@xml.tag!('gco:CharacterString', s)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if s.nil?
|
100
|
+
@xml.tag!('gmd:abstract', {'gco:nilReason' => 'missing'})
|
101
|
+
end
|
102
|
+
|
103
|
+
# data identification - purpose
|
104
|
+
s = hData[:purpose]
|
105
|
+
unless s.nil?
|
106
|
+
@xml.tag!('gmd:purpose') do
|
107
|
+
@xml.tag!('gco:CharacterString', s)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
111
|
+
@xml.tag!('gmd:purpose')
|
112
|
+
end
|
113
|
+
|
114
|
+
# data identification - credit []
|
115
|
+
aCredits = hData[:credits]
|
116
|
+
aCredits.each do |credit|
|
117
|
+
@xml.tag!('gmd:credit') do
|
118
|
+
@xml.tag!('gco:CharacterString', credit)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
if aCredits.empty? && @hResponseObj[:writerShowTags]
|
122
|
+
@xml.tag!('gmd:credit')
|
123
|
+
end
|
124
|
+
|
125
|
+
# data identification - status []
|
126
|
+
aStatus = hData[:status]
|
127
|
+
aStatus.each do |code|
|
128
|
+
@xml.tag!('gmd:status') do
|
129
|
+
codelistClass.writeXML('gmd', 'iso_progress', code)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
if aStatus.empty? && @hResponseObj[:writerShowTags]
|
133
|
+
@xml.tag!('gmd:status')
|
134
|
+
end
|
135
|
+
|
136
|
+
# data identification - point of contact
|
137
|
+
aRParties = hData[:pointOfContacts]
|
138
|
+
aRParties.each do |hRParty|
|
139
|
+
role = hRParty[:roleName]
|
140
|
+
aParties = hRParty[:parties]
|
141
|
+
aParties.each do |hParty|
|
142
|
+
@xml.tag!('gmd:pointOfContact') do
|
143
|
+
rPartyClass.writeXML(role, hParty)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
if aRParties.empty? && @hResponseObj[:writerShowTags]
|
148
|
+
@xml.tag!('gmd:pointOfContact', {'gco:nilReason' => 'missing'})
|
149
|
+
end
|
150
|
+
|
151
|
+
# data identification - resource maintenance []
|
152
|
+
aMaint = hData[:resourceMaintenance]
|
153
|
+
aMaint.each do |hMaint|
|
154
|
+
@xml.tag!('gmd:resourceMaintenance') do
|
155
|
+
mInfoClass.writeXML(hMaint)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
if aMaint.empty? && @hResponseObj[:writerShowTags]
|
159
|
+
@xml.tag!('gmd:resourceMaintenance')
|
160
|
+
end
|
161
|
+
|
162
|
+
# data identification - graphic overview []
|
163
|
+
aGraphics = hData[:graphicOverviews]
|
164
|
+
aGraphics.each do |hGraphic|
|
165
|
+
@xml.tag!('gmd:graphicOverview') do
|
166
|
+
bGraphicClass.writeXML(hGraphic)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
if aGraphics.empty? && @hResponseObj[:writerShowTags]
|
170
|
+
@xml.tag!('gmd:graphicOverview')
|
171
|
+
end
|
172
|
+
|
173
|
+
# data identification - resource format []
|
174
|
+
aFormats = hData[:resourceFormats]
|
175
|
+
aFormats.each do |hResFormat|
|
176
|
+
@xml.tag!('gmd:resourceFormat') do
|
177
|
+
rFormatClass.writeXML(hResFormat)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
if aFormats.empty? && @hResponseObj[:writerShowTags]
|
181
|
+
@xml.tag!('gmd:resourceFormat')
|
182
|
+
end
|
183
|
+
|
184
|
+
# data identification - descriptive keywords []
|
185
|
+
aKeywords = hData[:keywords]
|
186
|
+
aKeywords.each do |hKeyword|
|
187
|
+
@xml.tag!('gmd:descriptiveKeywords') do
|
188
|
+
keywordClass.writeXML(hKeyword)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
if aKeywords.empty? && @hResponseObj[:writerShowTags]
|
192
|
+
@xml.tag!('gmd:descriptiveKeywords')
|
193
|
+
end
|
194
|
+
|
195
|
+
# data identification - resource specific usage []
|
196
|
+
aUses = hData[:resourceUsages]
|
197
|
+
aUses.each do |hResUse|
|
198
|
+
@xml.tag!('gmd:resourceSpecificUsage') do
|
199
|
+
useClass.writeXML(hResUse)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
if aUses.empty? && @hResponseObj[:writerShowTags]
|
203
|
+
@xml.tag!('gmd:resourceSpecificUsage')
|
204
|
+
end
|
205
|
+
|
206
|
+
# data identification - resource constraints {}
|
207
|
+
aCons = hData[:constraints]
|
208
|
+
aCons.each do |hCon|
|
209
|
+
@xml.tag!('gmd:resourceConstraints') do
|
210
|
+
type = hCon[:type]
|
211
|
+
if type == 'use'
|
212
|
+
uConClass.writeXML(hCon)
|
213
|
+
end
|
214
|
+
if type == 'legal'
|
215
|
+
lConClass.writeXML(hCon)
|
216
|
+
end
|
217
|
+
if type == 'security'
|
218
|
+
sConClass.writeXML(hCon)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
if aCons.nil? && @hResponseObj[:writerShowTags]
|
223
|
+
@xml.tag!('gmd:resourceConstraints')
|
224
|
+
end
|
225
|
+
|
226
|
+
# data identification - aggregate information []
|
227
|
+
aAssocRes.each do |hAssocRes|
|
228
|
+
@xml.tag!('gmd:aggregationInfo') do
|
229
|
+
aggInfoClass.writeXML(hAssocRes)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
if aAssocRes.empty? && @hResponseObj[:writerShowTags]
|
233
|
+
@xml.tag!('gmd:aggregationInfo')
|
234
|
+
end
|
235
|
+
|
236
|
+
# data identification - taxonomy
|
237
|
+
hTaxonomy = hData[:taxonomy]
|
238
|
+
unless hTaxonomy.empty?
|
239
|
+
@xml.tag!('gmd:taxonomy') do
|
240
|
+
taxClass.writeXML(hTaxonomy)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
if hTaxonomy.empty? && @hResponseObj[:writerShowTags]
|
244
|
+
@xml.tag!('gmd:taxonomy')
|
245
|
+
end
|
246
|
+
|
247
|
+
# data identification - spatial representation type []
|
248
|
+
aSpatialType = hData[:spatialRepresentationTypes]
|
249
|
+
aSpatialType.each do |spType|
|
250
|
+
@xml.tag!('gmd:spatialRepresentationType') do
|
251
|
+
codelistClass.writeXML('gmd', 'iso_spatialRepresentation', spType)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
if aSpatialType.empty? && @hResponseObj[:writerShowTags]
|
255
|
+
@xml.tag!('gmd:spatialRepresentationType')
|
256
|
+
end
|
257
|
+
|
258
|
+
# data identification - spatial resolution []
|
259
|
+
aSpatialRes = hData[:spatialResolutions]
|
260
|
+
aSpatialRes.each do |hSpRes|
|
261
|
+
@xml.tag!('gmd:spatialResolution') do
|
262
|
+
resolutionClass.writeXML(hSpRes)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
if aSpatialRes.empty? && @hResponseObj[:writerShowTags]
|
266
|
+
@xml.tag!('gmd:spatialResolution')
|
267
|
+
end
|
268
|
+
|
269
|
+
# data identification - language [] (required)
|
270
|
+
aLocale = hData[:otherResourceLocales]
|
271
|
+
aLocale.insert(0, hData[:defaultResourceLocale])
|
272
|
+
aLocale.each do |hLocale|
|
273
|
+
s = hLocale[:languageCode]
|
274
|
+
unless hLocale[:countryCode].nil?
|
275
|
+
s += '; ' + hLocale[:countryCode]
|
276
|
+
end
|
277
|
+
@xml.tag!('gmd:language') do
|
278
|
+
@xml.tag!('gco:CharacterString', s)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
if aLocale.empty?
|
282
|
+
@xml.tag!('gmd:language') do
|
283
|
+
@xml.tag!('gco:CharacterString', 'eng; USA')
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
# data identification - characterSet [] (default 'utf8')
|
288
|
+
charSets = 0
|
289
|
+
aLocale.each do |hLocale|
|
290
|
+
s = hLocale[:characterEncoding]
|
291
|
+
unless s.nil?
|
292
|
+
@xml.tag!('gmd:characterSet') do
|
293
|
+
codelistClass.writeXML('gmd', 'iso_characterSet', s)
|
294
|
+
charSets += 1
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
if charSets == 0
|
299
|
+
@xml.tag!('gmd:language') do
|
300
|
+
@xml.tag!('gco:CharacterString', 'eng; USA')
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
# data identification - topic category []
|
305
|
+
# <- hData.keywords where keywordType='isoTopicCategory'
|
306
|
+
aTopics = []
|
307
|
+
aKeywords = hData[:keywords]
|
308
|
+
aKeywords.each do |hKeyword|
|
309
|
+
if hKeyword[:keywordType] == 'isoTopicCategory'
|
310
|
+
hKeyword[:keywords].each do |hKeyObj|
|
311
|
+
aTopics << hKeyObj[:keyword]
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
aTopics.each do |topic|
|
316
|
+
@xml.tag!('gmd:topicCategory') do
|
317
|
+
enumerationClass.writeXML('iso_topicCategory', topic)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
if aTopics.empty? && @hResponseObj[:writerShowTags]
|
321
|
+
@xml.tag!('gmd:topicCategory')
|
322
|
+
end
|
323
|
+
|
324
|
+
# data identification - environment description
|
325
|
+
s = hData[:environmentDescription]
|
326
|
+
unless s.nil?
|
327
|
+
@xml.tag!('gmd:environmentDescription') do
|
328
|
+
@xml.tag!('gco:CharacterString', s)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
332
|
+
@xml.tag!('gmd:environmentDescription')
|
333
|
+
end
|
334
|
+
|
335
|
+
# data identification - extent []
|
336
|
+
aExtents = hData[:extents]
|
337
|
+
aExtents.each do |hExtent|
|
338
|
+
@xml.tag!('gmd:extent') do
|
339
|
+
extentClass.writeXML(hExtent)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
if aExtents.empty? && @hResponseObj[:writerShowTags]
|
343
|
+
@xml.tag!('gmd:extent')
|
344
|
+
end
|
345
|
+
|
346
|
+
# data identification - supplemental info
|
347
|
+
s = hData[:supplementalInfo]
|
348
|
+
unless s.nil?
|
349
|
+
@xml.tag!('gmd:supplementalInformation') do
|
350
|
+
@xml.tag!('gco:CharacterString', s)
|
351
|
+
end
|
352
|
+
end
|
353
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
354
|
+
@xml.tag!('gmd:supplementalInformation')
|
355
|
+
end
|
356
|
+
|
357
|
+
end # gmd:MD_DataIdentification tag
|
358
|
+
end # writeXML
|
359
|
+
end # MD_DataIdentification class
|
360
|
+
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
353
364
|
end
|