adiwg-mdtranslator 2.13.3 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/CHANGELOG.md +11 -4
  4. data/Rakefile +14 -14
  5. data/adiwg-mdtranslator.gemspec +3 -3
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +14 -14
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_equalArcSecond.rb +69 -0
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_other.rb +42 -0
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_statePlane.rb +87 -0
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_ups.rb +58 -0
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_utm.rb +58 -0
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +7 -7
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +6 -6
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +23 -22
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +7 -7
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +6 -6
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +7 -7
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +6 -6
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +7 -7
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +6 -6
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +7 -7
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +5 -5
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +4 -4
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +8 -8
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +6 -6
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +20 -20
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +8 -8
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +6 -6
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +5 -5
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +5 -5
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +6 -6
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +6 -6
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +7 -7
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +5 -5
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +15 -7
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +6 -3
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +8 -6
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +1 -1
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalPlanar.rb → module_localPlanar.rb} +16 -8
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +23 -8
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +21 -144
  42. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +48 -3
  43. data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapCoordinateInfo.rb → module_planarCoordinateInfo.rb} +23 -11
  44. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +1 -1
  45. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +5 -2
  46. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +6 -2
  47. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +20 -5
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +41 -8
  49. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_localProjection.rb +57 -0
  50. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +6 -6
  51. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +36 -53
  52. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +1 -1
  53. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +39 -13
  54. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +20 -8
  55. data/lib/adiwg/mdtranslator/version.rb +11 -1
  56. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +8 -7
  57. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +1 -1
  58. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localPlanar.rb +63 -0
  59. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +30 -15
  60. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjectionTags.rb +164 -109
  61. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +60 -61
  62. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +12 -12
  63. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +87 -99
  64. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +16 -41
  65. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +12 -11
  66. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +9 -4
  67. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +2 -3
  68. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +8 -7
  69. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +13 -6
  70. data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +16 -30
  71. data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +8 -0
  72. data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +4 -4
  73. data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +68 -57
  74. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -6
  75. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +9 -0
  76. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +13 -12
  77. data/lib/adiwg/mdtranslator/writers/html/sections/html_usage.rb +3 -3
  78. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +9 -15
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +12 -15
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +9 -8
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +6 -6
  82. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +2 -1
  83. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +21 -10
  84. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +4 -0
  85. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +2 -3
  86. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_identifier.rb +4 -2
  87. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_localProjection.rb +31 -0
  88. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_obliqueLinePoint.rb +2 -2
  89. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -9
  90. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomy.rb +6 -5
  91. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +2 -2
  92. data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +10 -0
  93. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +21 -0
  94. metadata +17 -10
  95. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +0 -42
@@ -141,7 +141,13 @@ messageList:
141
141
  - {id: 301, message: "funding must have either an allocation or timePeriod"}
142
142
 
143
143
  - {id: 310, message: "geodetic object is empty"}
144
- - {id: 311, message: "geodetic ellipsoid name is missing"}
144
+ - {id: 311, message: "geodetic datum name is deprecated, use datumIdentifier.identifier"}
145
+ - {id: 312, message: "geodetic ellipsoid name is deprecated, use ellipsoidIdentifier.identifier"}
146
+ - {id: 313, message: "geodetic datum added new datumIdentifier object"}
147
+ - {id: 314, message: "geodetic ellipsoid added new ellipsoidIdentifier object"}
148
+ - {id: 315, message: "geodetic datum name was moved to datumIdentifier.identifier"}
149
+ - {id: 316, message: "geodetic ellipsoid name was moved to ellipsoidIdentifier.identifier"}
150
+ - {id: 317, message: "geodetic ellipsoid must have an ellipsoidIdentifier or an ellipsoidIdentifier plus all other elements"}
145
151
 
146
152
  - {id: 320, message: "geographic extent object is empty"}
147
153
  - {id: 321, message: "geographic extent must have at least one description, identifier, bounding box, or geographic element"}
@@ -266,7 +272,7 @@ messageList:
266
272
  - {id: 641, message: "process step description is missing"}
267
273
 
268
274
  - {id: 650, message: "projection parameters object is empty"}
269
- - {id: 651, message: "projection parameters projection code is missing"}
275
+ - {id: 651, message: "projection identifier is missing"}
270
276
 
271
277
  - {id: 660, message: "reference system parameter set is empty"}
272
278
  - {id: 661, message: "reference system parameter set must have at least one projection, geodetic, or vertical datum"}
@@ -281,7 +287,7 @@ messageList:
281
287
  - {id: 684, message: "resource status is missing"}
282
288
  - {id: 685, message: "topicCategory is deprecated, items were moved to keywords, keywordType 'isoTopicCategory'"}
283
289
  - {id: 686, message: "resource point-of-contact is missing"}
284
- - {id: 687, message: "taxonomy is now an array, the single taxonomy object was deprecated"}
290
+ - {id: 687, message: "taxonomy is an array, use of taxonomy object has been deprecated"}
285
291
  - {id: 688, message: "resource default locale is missing"}
286
292
 
287
293
  - {id: 690, message: "resource type object is empty"}
@@ -332,8 +338,11 @@ messageList:
332
338
 
333
339
  - {id: 830, message: "taxonomy object is empty"}
334
340
  - {id: 831, message: "taxonomic classification system object is missing"}
335
- - {id: 832, message: "taxonomic identification procedure is missing"}
336
341
  - {id: 833, message: "taxonomic classification is missing"}
342
+ - {id: 834, message: "taxonomic classification is an array, use of taxonomic classification object is deprecated"}
343
+ - {id: 835, message: "taxonomic identification reference as an identifier is deprecated, use citation"}
344
+ - {id: 836, message: "taxonomic identification reference authority was substituted for citation"}
345
+ - {id: 837, message: "taxonomic identification reference authority is empty or missing"}
337
346
 
338
347
  - {id: 840, message: "temporal extent object is empty"}
339
348
  - {id: 841, message: "temporal extent must have a time period or time instant"}
@@ -365,7 +374,11 @@ messageList:
365
374
  - {id: 911, message: "vector representation must have a topology level or vector object"}
366
375
 
367
376
  - {id: 920, message: "vertical datum object is empty"}
368
- - {id: 921, message: "vertical datum must have an identifier or all other elements"}
377
+ - {id: 921, message: "vertical datum must have a datumIdentifier"}
378
+ - {id: 922, message: "vertical datumName is deprecated, use datumIdentifier.identifier"}
379
+ - {id: 923, message: "vertical datumName was moved to datumIdentifier.identifier"}
380
+ - {id: 924, message: "vertical datum must have a datumIdentifier or a datumIdentifier plus all other elements"}
381
+ - {id: 925, message: "vertical datum added new datumIdentifier object"}
369
382
 
370
383
  - {id: 930, message: "vertical extent object is empty"}
371
384
  - {id: 931, message: "vertical extent minimum value is missing"}
@@ -375,3 +388,5 @@ messageList:
375
388
  - {id: 940, message: "voucher object is empty"}
376
389
  - {id: 941, message: "voucher specimen is missing"}
377
390
  - {id: 942, message: "voucher repository is missing"}
391
+
392
+ - {id: 950, message: "local projection object is empty"}
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-26 deprecated datumName and ellipseName
5
6
  # Stan Smith 2018-06-19 refactored error and warning messaging
6
7
  # Stan Smith 2017-10-23 original script
7
8
 
@@ -41,10 +42,18 @@ module ADIWG
41
42
  end
42
43
  end
43
44
 
44
- # geodetic - datum name
45
+ # TODO remove when mdJson version 3
46
+ # geodetic - datum name (deprecated), move to datumIdentifier
47
+ # skip datumName if identifier is already present
45
48
  if hGeodetic.has_key?('datumName')
46
49
  unless hGeodetic['datumName'] == ''
47
- intGeodetic[:datumName] = hGeodetic['datumName']
50
+ @MessagePath.issueWarning(311, responseObj, inContext)
51
+ if intGeodetic[:datumIdentifier].empty?
52
+ intGeodetic[:datumIdentifier] = intMetadataClass.newIdentifier
53
+ intGeodetic[:datumIdentifier][:identifier] = hGeodetic['datumName']
54
+ @MessagePath.issueNotice(313, responseObj, inContext)
55
+ @MessagePath.issueNotice(315, responseObj, inContext)
56
+ end
48
57
  end
49
58
  end
50
59
 
@@ -58,25 +67,36 @@ module ADIWG
58
67
  end
59
68
  end
60
69
 
61
- # geodetic - ellipsoid name (required)
70
+ # TODO remove when mdJson version 3
71
+ # geodetic - ellipsoid name (deprecated), move to ellipsoidIdentifier
72
+ # skip ellipsoidName if identifier is already present
62
73
  if hGeodetic.has_key?('ellipsoidName')
63
- intGeodetic[:ellipsoidName] = hGeodetic['ellipsoidName']
64
- end
65
- if intGeodetic[:ellipsoidName].nil? || intGeodetic[:ellipsoidName] == ''
66
- @MessagePath.issueError(311, responseObj, inContext)
74
+ unless hGeodetic['ellipsoidName'] == ''
75
+ @MessagePath.issueWarning(312, responseObj, inContext)
76
+ if intGeodetic[:ellipsoidIdentifier].empty?
77
+ intGeodetic[:ellipsoidIdentifier] = intMetadataClass.newIdentifier
78
+ intGeodetic[:ellipsoidIdentifier][:identifier] = hGeodetic['ellipsoidName']
79
+ @MessagePath.issueNotice(314, responseObj, inContext)
80
+ @MessagePath.issueNotice(316, responseObj, inContext)
81
+ end
82
+ end
67
83
  end
68
84
 
85
+ haveOthers = 0
86
+
69
87
  # geodetic - semi-major axis
70
88
  if hGeodetic.has_key?('semiMajorAxis')
71
89
  unless hGeodetic['semiMajorAxis'] == ''
72
90
  intGeodetic[:semiMajorAxis] = hGeodetic['semiMajorAxis']
91
+ haveOthers += 1
73
92
  end
74
93
  end
75
94
 
76
95
  # geodetic - axis units
77
96
  if hGeodetic.has_key?('axisUnits')
78
- unless['axisUnits'] == ''
97
+ unless hGeodetic['axisUnits'] == ''
79
98
  intGeodetic[:axisUnits] = hGeodetic['axisUnits']
99
+ haveOthers += 1
80
100
  end
81
101
  end
82
102
 
@@ -84,10 +104,23 @@ module ADIWG
84
104
  if hGeodetic.has_key?('denominatorOfFlatteningRatio')
85
105
  unless hGeodetic['denominatorOfFlatteningRatio'] == ''
86
106
  intGeodetic[:denominatorOfFlatteningRatio] = hGeodetic['denominatorOfFlatteningRatio']
107
+ haveOthers += 1
108
+ end
109
+ end
110
+
111
+ # error messages
112
+ if intGeodetic[:ellipsoidIdentifier].empty?
113
+ unless haveOthers == 0
114
+ @MessagePath.issueError(317, responseObj, inContext)
115
+ end
116
+ else
117
+ unless haveOthers == 0 || haveOthers == 3
118
+ @MessagePath.issueError(317, responseObj, inContext)
87
119
  end
88
120
  end
89
121
 
90
122
  return intGeodetic
123
+
91
124
  end
92
125
 
93
126
  end
@@ -0,0 +1,57 @@
1
+ # unpack spatial reference system parameter oblique line point
2
+ # Reader - ADIwg JSON to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2018-10-08 original script
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Readers
10
+ module MdJson
11
+
12
+ module LocalProjection
13
+
14
+ def self.unpack(hLocal, responseObj, inContext = nil)
15
+
16
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
17
+
18
+ # return nil object if input is empty
19
+ if hLocal.empty?
20
+ @MessagePath.issueWarning(950, responseObj, inContext)
21
+ return nil
22
+ end
23
+
24
+ # instance classes needed in script
25
+ intMetadataClass = InternalMetadata.new
26
+ intLocal = intMetadataClass.newLocal
27
+
28
+ # local projection - fixed to earth (required) {boolean default = true}
29
+ if hLocal.has_key?('fixedToEarth')
30
+ if hLocal['fixedToEarth'] === false
31
+ intLocal[:fixedToEarth] = false
32
+ end
33
+ end
34
+
35
+ # local projection - description
36
+ if hLocal.has_key?('description')
37
+ unless hLocal['description'] == ''
38
+ intLocal[:description] = hLocal['description']
39
+ end
40
+ end
41
+
42
+ # local projection - georeference
43
+ if hLocal.has_key?('georeference')
44
+ unless hLocal['georeference'] == ''
45
+ intLocal[:georeference] = hLocal['georeference']
46
+ end
47
+ end
48
+
49
+ return intLocal
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
@@ -27,18 +27,18 @@ module ADIWG
27
27
  intLinePoint = intMetadataClass.newObliqueLinePoint
28
28
 
29
29
  # oblique line point - azimuth line latitude (required)
30
- if hLinePt.has_key?('azimuthLineLatitude')
31
- intLinePoint[:azimuthLineLatitude] = hLinePt['azimuthLineLatitude']
30
+ if hLinePt.has_key?('obliqueLineLatitude')
31
+ intLinePoint[:obliqueLineLatitude] = hLinePt['obliqueLineLatitude']
32
32
  end
33
- if intLinePoint[:azimuthLineLatitude].nil? || intLinePoint[:azimuthLineLatitude] == ''
33
+ if intLinePoint[:obliqueLineLatitude].nil? || intLinePoint[:obliqueLineLatitude] == ''
34
34
  @MessagePath.issueError(591, responseObj, inContext)
35
35
  end
36
36
 
37
37
  # oblique line point - azimuth line longitude (required)
38
- if hLinePt.has_key?('azimuthLineLongitude')
39
- intLinePoint[:azimuthLineLongitude] = hLinePt['azimuthLineLongitude']
38
+ if hLinePt.has_key?('obliqueLineLongitude')
39
+ intLinePoint[:obliqueLineLongitude] = hLinePt['obliqueLineLongitude']
40
40
  end
41
- if intLinePoint[:azimuthLineLongitude].nil? || intLinePoint[:azimuthLineLongitude] == ''
41
+ if intLinePoint[:obliqueLineLongitude].nil? || intLinePoint[:obliqueLineLongitude] == ''
42
42
  @MessagePath.issueError(592, responseObj, inContext)
43
43
  end
44
44
 
@@ -2,11 +2,13 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-08 refactor mdJson projection object
5
6
  # Stan Smith 2018-06-22 refactored error and warning messaging
6
7
  # Stan Smith 2017-10-23 original script
7
8
 
8
9
  require_relative 'module_identifier'
9
10
  require_relative 'module_obliqueLinePoint'
11
+ require_relative 'module_localProjection'
10
12
 
11
13
  module ADIWG
12
14
  module Mdtranslator
@@ -30,44 +32,42 @@ module ADIWG
30
32
  intProjection = intMetadataClass.newProjection
31
33
 
32
34
  outContext = 'projection parameters'
33
- outContext = inContext + ' > ' + outContext unless inContext.nil?
35
+ outContext = inContext + ' ' + outContext unless inContext.nil?
34
36
 
35
- # projection parameters - projection identifier {identifier}
37
+ # projection parameters - projection identifier {identifier} (required)
38
+ # add name to identifier object
36
39
  if hProjection.has_key?('projectionIdentifier')
37
40
  unless hProjection['projectionIdentifier'].empty?
38
- hReturn = Identifier.unpack(hProjection['projectionIdentifier'], responseObj, outContext)
41
+ hProjectionId = hProjection['projectionIdentifier']
42
+ hReturn = Identifier.unpack(hProjectionId, responseObj, outContext)
39
43
  unless hReturn.nil?
44
+ if hProjectionId.has_key?('name')
45
+ unless hProjectionId['name'] == ''
46
+ hReturn[:name] = hProjectionId['name']
47
+ end
48
+ end
40
49
  intProjection[:projectionIdentifier] = hReturn
41
50
  end
42
51
  end
43
52
  end
44
-
45
- # projection parameters - grid system
46
- if hProjection.has_key?('gridSystem')
47
- unless hProjection['gridSystem'] == ''
48
- intProjection[:gridSystem] = hProjection['gridSystem']
49
- end
50
- end
51
-
52
- # projection parameters - grid system name
53
- if hProjection.has_key?('gridSystemName')
54
- unless hProjection['gridSystemName'] == ''
55
- intProjection[:gridSystemName] = hProjection['gridSystemName']
56
- end
57
- end
58
-
59
- # projection parameters - projection (required)
60
- if hProjection.has_key?('projection')
61
- intProjection[:projection] = hProjection['projection']
62
- end
63
- if intProjection[:projection].nil? || intProjection[:projection] == ''
53
+ if intProjection[:projectionIdentifier].empty?
64
54
  @MessagePath.issueError(651, responseObj, inContext)
65
55
  end
66
56
 
67
- # projection parameters - projection name
68
- if hProjection.has_key?('projectionName')
69
- unless hProjection['projectionName'] == ''
70
- intProjection[:projectionName] = hProjection['projectionName']
57
+ # projection parameters - grid system identifier {identifier}
58
+ # add name to identifier object
59
+ if hProjection.has_key?('gridIdentifier')
60
+ unless hProjection['gridIdentifier'].empty?
61
+ hGridSystemId = hProjection['gridIdentifier']
62
+ hReturn = Identifier.unpack(hProjection['gridIdentifier'], responseObj, outContext)
63
+ unless hReturn.nil?
64
+ if hGridSystemId.has_key?('name')
65
+ unless hGridSystemId['name'] == ''
66
+ hReturn[:name] = hGridSystemId['name']
67
+ end
68
+ end
69
+ intProjection[:gridIdentifier] = hReturn
70
+ end
71
71
  end
72
72
  end
73
73
 
@@ -137,7 +137,8 @@ module ADIWG
137
137
  # projection parameters - height of prospective point above surface
138
138
  if hProjection.has_key?('heightOfProspectivePointAboveSurface')
139
139
  unless hProjection['heightOfProspectivePointAboveSurface'] == ''
140
- intProjection[:heightOfProspectivePointAboveSurface] = hProjection['heightOfProspectivePointAboveSurface'].to_f
140
+ intProjection[:heightOfProspectivePointAboveSurface] =
141
+ hProjection['heightOfProspectivePointAboveSurface']
141
142
  end
142
143
  end
143
144
 
@@ -222,31 +223,13 @@ module ADIWG
222
223
  end
223
224
  end
224
225
 
225
- # projection parameters - local planar description
226
- if hProjection.has_key?('localPlanarDescription')
227
- unless hProjection['localPlanarDescription'] == ''
228
- intProjection[:localPlanarDescription] = hProjection['localPlanarDescription']
229
- end
230
- end
231
-
232
- # projection parameters - local planar georeference
233
- if hProjection.has_key?('localPlanarGeoreference')
234
- unless hProjection['localPlanarGeoreference'] == ''
235
- intProjection[:localPlanarGeoreference] = hProjection['localPlanarGeoreference']
236
- end
237
- end
238
-
239
- # projection parameters - other projection description
240
- if hProjection.has_key?('otherProjectionDescription')
241
- unless hProjection['otherProjectionDescription'] == ''
242
- intProjection[:otherProjectionDescription] = hProjection['otherProjectionDescription']
243
- end
244
- end
245
-
246
- # projection parameters - other grid description
247
- if hProjection.has_key?('otherGridDescription')
248
- unless hProjection['otherGridDescription'] == ''
249
- intProjection[:otherGridDescription] = hProjection['otherGridDescription']
226
+ # projection parameters - local projection [] {local}
227
+ if hProjection.has_key?('local')
228
+ unless hProjection['local'].empty?
229
+ hReturn = LocalProjection.unpack(hProjection['local'], responseObj, outContext)
230
+ unless hReturn.nil?
231
+ intProjection[:local] = hReturn
232
+ end
250
233
  end
251
234
  end
252
235
 
@@ -31,7 +31,7 @@ module ADIWG
31
31
  intParamSet = intMetadataClass.newReferenceSystemParameterSet
32
32
 
33
33
  outContext = 'reference system parameter set'
34
- outContext = inContext + ' > ' + outContext unless inContext.nil?
34
+ outContext = inContext + ' ' + outContext unless inContext.nil?
35
35
 
36
36
  haveParams = false
37
37
 
@@ -2,11 +2,14 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-10-27 change identification reference to citation
6
+ # Stan Smith 2018-10-27 identification procedure no longer required
7
+ # Stan Smith 2018-10-19 refactor taxonomic classification as array
5
8
  # Stan Smith 2018-06-26 refactored error and warning messaging
6
9
  # Stan Smith 2016-10-22 original script
7
10
 
8
11
  require_relative 'module_taxonomicSystem'
9
- require_relative 'module_identifier'
12
+ require_relative 'module_citation'
10
13
  require_relative 'module_responsibleParty'
11
14
  require_relative 'module_voucher'
12
15
  require_relative 'module_taxonomicClassification'
@@ -53,12 +56,29 @@ module ADIWG
53
56
  end
54
57
  end
55
58
 
56
- # taxonomy - identification reference [{identifier}]
59
+ # taxonomy - identification reference [{citation}]
60
+ # identification reference as an identifier is now deprecated
57
61
  if hTaxonomy.has_key?('identificationReference')
58
62
  aItems = hTaxonomy['identificationReference']
59
63
  aItems.each do |hItem|
60
64
  unless hItem.empty?
61
- hReturn = Identifier.unpack(hItem, responseObj)
65
+ if hItem.has_key?('identifier')
66
+ @MessagePath.issueNotice(835, responseObj)
67
+ if hItem.has_key?('authority')
68
+ hCitation = hItem['authority']
69
+ @MessagePath.issueNotice(836, responseObj)
70
+ if hCitation.empty?
71
+ @MessagePath.issueNotice(837, responseObj)
72
+ break
73
+ end
74
+ else
75
+ @MessagePath.issueNotice(837, responseObj)
76
+ break
77
+ end
78
+ else
79
+ hCitation = hItem
80
+ end
81
+ hReturn = Citation.unpack(hCitation, responseObj)
62
82
  unless hReturn.nil?
63
83
  intTaxonomy[:idReferences] << hReturn
64
84
  end
@@ -77,15 +97,12 @@ module ADIWG
77
97
  end
78
98
  end
79
99
 
80
- # taxonomy - identification procedure (required)
100
+ # taxonomy - identification procedure
81
101
  if hTaxonomy.has_key?('identificationProcedure')
82
102
  unless hTaxonomy['identificationProcedure'] == ''
83
103
  intTaxonomy[:idProcedure] = hTaxonomy['identificationProcedure']
84
104
  end
85
105
  end
86
- if intTaxonomy[:idProcedure].nil? || intTaxonomy[:idProcedure] == ''
87
- @MessagePath.issueError(832, responseObj)
88
- end
89
106
 
90
107
  # taxonomy - identification completeness
91
108
  if hTaxonomy.has_key?('identificationCompleteness')
@@ -105,17 +122,26 @@ module ADIWG
105
122
  end
106
123
  end
107
124
 
108
- # taxonomy - taxonomic classification {taxonomicClassification} (required)
125
+ # taxonomy - taxonomic classification [] {taxonomicClassification} (required)
126
+ # support deprecated taxonomicClassification{}
109
127
  if hTaxonomy.has_key?('taxonomicClassification')
110
- item = hTaxonomy['taxonomicClassification']
111
- unless item.empty?
112
- hReturn = TaxonomicClassification.unpack(item, responseObj)
128
+ aItems = hTaxonomy['taxonomicClassification']
129
+ if aItems.is_a?(Array)
130
+ aItems.each do |item|
131
+ hReturn = TaxonomicClassification.unpack(item, responseObj)
132
+ unless hReturn.nil?
133
+ intTaxonomy[:taxonClasses] << hReturn
134
+ end
135
+ end
136
+ else
137
+ hReturn = TaxonomicClassification.unpack(aItems, responseObj)
113
138
  unless hReturn.nil?
114
- intTaxonomy[:taxonClass] = hReturn
139
+ intTaxonomy[:taxonClasses] << hReturn
115
140
  end
141
+ @MessagePath.issueNotice(834, responseObj)
116
142
  end
117
143
  end
118
- if intTaxonomy[:taxonClass].empty?
144
+ if intTaxonomy[:taxonClasses].empty?
119
145
  @MessagePath.issueError(833, responseObj)
120
146
  end
121
147
 
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-26 datumName is deprecated, use datumIdentifier.identifier
5
6
  # Stan Smith 2018-06-27 refactored error and warning messaging
6
7
  # Stan Smith 2017-10-23 original script
7
8
 
@@ -31,7 +32,7 @@ module ADIWG
31
32
  outContext = 'vertical datum'
32
33
  outContext = inContext + ' > ' + outContext unless inContext.nil?
33
34
 
34
- # vertical datum - identifier {identifier}
35
+ # vertical datum - identifier {identifier} (required)
35
36
  if hDatum.has_key?('datumIdentifier')
36
37
  unless hDatum['datumIdentifier'].empty?
37
38
  hReturn = Identifier.unpack(hDatum['datumIdentifier'], responseObj, outContext)
@@ -40,17 +41,27 @@ module ADIWG
40
41
  end
41
42
  end
42
43
  end
44
+ if intDatum[:datumIdentifier].empty?
45
+ @MessagePath.issueError(921, responseObj, inContext)
46
+ end
43
47
 
44
- haveOthers = 0
45
-
46
- # vertical datum - datum name
48
+ # TODO remove when mdJson version 3
49
+ # vertical datum - datum name (deprecated), move to datumIdentifier
50
+ # skip datumName if identifier is already present
47
51
  if hDatum.has_key?('datumName')
48
52
  unless hDatum['datumName'] == ''
49
- intDatum[:datumName] = hDatum['datumName']
50
- haveOthers += 1
53
+ @MessagePath.issueWarning(922, responseObj, inContext)
54
+ if intDatum[:datumIdentifier].empty?
55
+ intDatum[:datumIdentifier] = intMetadataClass.newIdentifier
56
+ intDatum[:datumIdentifier][:identifier] = hDatum['datumName']
57
+ @MessagePath.issueNotice(925, responseObj, inContext)
58
+ @MessagePath.issueNotice(923, responseObj, inContext)
59
+ end
51
60
  end
52
61
  end
53
62
 
63
+ haveOthers = 0
64
+
54
65
  # vertical datum - encoding method
55
66
  if hDatum.has_key?('encodingMethod')
56
67
  unless hDatum['encodingMethod'] == ''
@@ -83,11 +94,12 @@ module ADIWG
83
94
  end
84
95
 
85
96
  # error messages
86
- if intDatum[:datumIdentifier].empty? && haveOthers != 4
87
- @MessagePath.issueError(921, responseObj, inContext)
97
+ unless haveOthers == 0 || haveOthers == 3
98
+ @MessagePath.issueError(924, responseObj, inContext)
88
99
  end
89
100
 
90
101
  return intDatum
102
+
91
103
  end
92
104
 
93
105
  end
@@ -1,6 +1,16 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.14.0 2018-10-27 refactor taxonomy for multiple taxonomic classifications
5
+ # 2.14.0 2018-10-27 refactor taxonomy for identification reference as citation
6
+ # 2.14.0 2018-10-27 refactor taxonomy for identification procedures not required
7
+ # 2.14.0 2018-10-27 refactor spatial reference for reorganized parameter set
8
+ # 2.13.4 2018-09-28 add budget sourceId and recipientId to sbJSON contacts list
9
+ # 2.13.4 2018-09-26 deprecated ellipsoidName from geodetic, use ellipsoidIdentifier
10
+ # 2.13.4 2018-09-26 deprecated datumName from geodetic, use datumIdentifier
11
+ # 2.13.4 2018-09-26 deprecated datumName from verticalDatum object, use datumIdentifier
12
+ # 2.13.4 2018-09-26 change azimuthLineLongitude to obliqueLineLongitude
13
+ # 2.13.4 2018-09-26 change azimuthLineLatitude to obliqueLineLatitude
4
14
  # 2.13.3 2018-09-06 bug fix #201 change crossReference processing to an array
5
15
  # 2.13.3 2018-09-05 bug fix #202 skip responsibility contacts in associatedResource for sbJson
6
16
  # 2.13.2 2018-07-31 fix timeInterval check to allow real and integer
@@ -91,7 +101,7 @@
91
101
  module ADIWG
92
102
  module Mdtranslator
93
103
  # current mdtranslator version
94
- VERSION = "2.13.3"
104
+ VERSION = "2.14.0"
95
105
  end
96
106
  end
97
107
 
@@ -2,6 +2,7 @@
2
2
  # FGDC CSDGM writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-27 deprecated datumName and ellipsoidName
5
6
  # Stan Smith 2018-03-18 refactored error and warning messaging
6
7
  # Stan Smith 2018-01-15 original script
7
8
 
@@ -20,21 +21,21 @@ module ADIWG
20
21
  @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
22
  end
22
23
 
23
- def writeXML(hGeodetic)
24
+ def writeXML(hGeodetic, inContext = nil)
24
25
 
25
26
  # geodetic reference system 4.1.4.1 (horizdn) - horizontal datum name
26
- unless hGeodetic[:datumName].nil?
27
- @xml.tag!('horizdn', hGeodetic[:datumName])
27
+ unless hGeodetic[:datumIdentifier].empty?
28
+ @xml.tag!('horizdn', hGeodetic[:datumIdentifier][:identifier])
28
29
  end
29
- if hGeodetic[:datumName].nil? && @hResponseObj[:writerShowTags]
30
+ if hGeodetic[:datumIdentifier].empty? && @hResponseObj[:writerShowTags]
30
31
  @xml.tag!('horizdn')
31
32
  end
32
33
 
33
34
  # geodetic reference system 4.1.4.2 (ellips) - ellipsoid name (required)
34
- unless hGeodetic[:ellipsoidName].nil?
35
- @xml.tag!('ellips', hGeodetic[:ellipsoidName])
35
+ unless hGeodetic[:ellipsoidIdentifier].empty?
36
+ @xml.tag!('ellips', hGeodetic[:ellipsoidIdentifier][:identifier])
36
37
  end
37
- if hGeodetic[:ellipsoidName].nil?
38
+ if hGeodetic[:ellipsoidIdentifier].nil?
38
39
  @NameSpace.issueWarning(150, 'ellips')
39
40
  end
40
41
 
@@ -20,7 +20,7 @@ module ADIWG
20
20
  @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
21
  end
22
22
 
23
- def writeXML(hGeoRes)
23
+ def writeXML(hGeoRes, inContext = nil)
24
24
 
25
25
  # horizontal reference 4.1.1 (geograph) - geographic resolution
26
26