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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +11 -4
- data/Rakefile +14 -14
- data/adiwg-mdtranslator.gemspec +3 -3
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +14 -14
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_equalArcSecond.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_other.rb +42 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_statePlane.rb +87 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_ups.rb +58 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/gridSystems/grid_utm.rb +58 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +23 -22
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +20 -20
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +15 -7
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +6 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalPlanar.rb → module_localPlanar.rb} +16 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +23 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +21 -144
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +48 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapCoordinateInfo.rb → module_planarCoordinateInfo.rb} +23 -11
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +5 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +6 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +20 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +41 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_localProjection.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +36 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +39 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +20 -8
- data/lib/adiwg/mdtranslator/version.rb +11 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +8 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localPlanar.rb +63 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +30 -15
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjectionTags.rb +164 -109
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +60 -61
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +12 -12
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +87 -99
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +16 -41
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +12 -11
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +9 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +2 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +8 -7
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +13 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +16 -30
- data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +8 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +68 -57
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +9 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +13 -12
- data/lib/adiwg/mdtranslator/writers/html/sections/html_usage.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +9 -15
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +12 -15
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +9 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +2 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +21 -10
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +4 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +2 -3
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_identifier.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_localProjection.rb +31 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_obliqueLinePoint.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -9
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomy.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +10 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +21 -0
- metadata +17 -10
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +0 -42
@@ -2,6 +2,7 @@
|
|
2
2
|
# unpack fgdc horizontal data local reference
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-10-05 refactor mdJson projection object
|
5
6
|
# Stan Smith 2017-12-29 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
@@ -12,31 +13,45 @@ module ADIWG
|
|
12
13
|
module Readers
|
13
14
|
module Fgdc
|
14
15
|
|
15
|
-
module
|
16
|
+
module MapLocalSystem
|
16
17
|
|
17
18
|
def self.unpack(xLocal, hResponseObj)
|
18
19
|
|
19
20
|
# instance classes needed in script
|
20
21
|
intMetadataClass = InternalMetadata.new
|
21
|
-
|
22
22
|
hProjection = intMetadataClass.newProjection
|
23
|
-
|
24
|
-
|
23
|
+
hIdentifier = intMetadataClass.newIdentifier
|
24
|
+
hLocal = intMetadataClass.newLocal
|
25
|
+
hProjection[:projectionIdentifier] = hIdentifier
|
26
|
+
hProjection[:local] = hLocal
|
27
|
+
|
28
|
+
hIdentifier[:identifier] = 'localSystem'
|
29
|
+
hIdentifier[:name] = 'Local Coordinate System'
|
30
|
+
hLocal[:fixedToEarth] = false
|
25
31
|
|
26
32
|
# local planar 4.1.3.1 (localdes) - local description
|
27
|
-
# ->
|
33
|
+
# -> ReferenceSystemParameters.projection.local.description
|
28
34
|
description = xLocal.xpath('./localdes').text
|
29
35
|
unless description.empty?
|
30
|
-
|
36
|
+
hLocal[:description] = description
|
37
|
+
end
|
38
|
+
if description.empty?
|
39
|
+
hResponseObj[:readerExecutionMessages] <<
|
40
|
+
'WARNING: FGDC reader: local coordinate system description is missing'
|
31
41
|
end
|
32
42
|
|
33
43
|
# local planar 4.1.3.2 (localgeo) - local georeference information
|
34
|
-
# ->
|
44
|
+
# -> ReferenceSystemParameters.projection.local.georeference
|
35
45
|
georeference = xLocal.xpath('./localgeo').text
|
36
46
|
unless georeference.empty?
|
37
|
-
|
47
|
+
hLocal[:georeference] = georeference
|
48
|
+
end
|
49
|
+
if georeference.empty?
|
50
|
+
hResponseObj[:readerExecutionMessages] <<
|
51
|
+
'WARNING: FGDC reader: local coordinate system georeference information is missing'
|
38
52
|
end
|
39
53
|
|
54
|
+
# packing
|
40
55
|
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
41
56
|
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
42
57
|
hSystemParameters[:projection] = hProjection
|
@@ -2,16 +2,15 @@
|
|
2
2
|
# unpack fgdc map grid coordinate system
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-10-04 refactor mdJson projection object
|
5
6
|
# Stan Smith 2017-10-04 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
8
|
-
require_relative '
|
9
|
-
require_relative '
|
10
|
-
require_relative '
|
11
|
-
require_relative '
|
12
|
-
require_relative '
|
13
|
-
require_relative 'mapProjections/projection_equirectangular'
|
14
|
-
require_relative 'mapProjections/projection_azimuthEquidistant'
|
9
|
+
require_relative 'gridSystems/grid_utm'
|
10
|
+
require_relative 'gridSystems/grid_ups'
|
11
|
+
require_relative 'gridSystems/grid_statePlane'
|
12
|
+
require_relative 'gridSystems/grid_equalArcSecond'
|
13
|
+
require_relative 'gridSystems/grid_other'
|
15
14
|
|
16
15
|
module ADIWG
|
17
16
|
module Mdtranslator
|
@@ -25,178 +24,56 @@ module ADIWG
|
|
25
24
|
# instance classes needed in script
|
26
25
|
intMetadataClass = InternalMetadata.new
|
27
26
|
hProjection = intMetadataClass.newProjection
|
27
|
+
hGridSystemId = intMetadataClass.newIdentifier
|
28
|
+
hProjectionId = intMetadataClass.newIdentifier
|
29
|
+
hProjection[:gridIdentifier] = hGridSystemId
|
30
|
+
hProjection[:projectionIdentifier] = hProjectionId
|
28
31
|
|
29
32
|
# grid system 4.1.2.2.1 (gridsysn) - grid coordinate system name (required)
|
30
33
|
# -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
|
31
34
|
gridName = xMapGrid.xpath('./gridsysn').text
|
32
35
|
unless gridName.empty?
|
33
|
-
|
36
|
+
hGridSystemId[:name] = gridName
|
34
37
|
end
|
35
38
|
if gridName.empty?
|
36
39
|
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: grid system name is missing'
|
37
40
|
end
|
38
41
|
|
39
|
-
haveGrid = false
|
40
42
|
# grid system 4.1.2.2.2 (utm) - universal transverse mercator
|
41
43
|
xUTM = xMapGrid.xpath('./utm')
|
42
44
|
unless xUTM.empty?
|
43
|
-
|
44
|
-
haveGrid = true
|
45
|
-
hProjection[:gridSystem] = 'utm'
|
46
|
-
hProjection[:gridSystemName] = 'Universal Transverse Mercator (UTM)' if gridName.empty?
|
47
|
-
|
48
|
-
# grid system 4.1.2.2.2.1 (utmzone) - utm zone number {-60..-1, 1..60} (required)
|
49
|
-
# -> ReferenceSystemParameters.projection.gridZone
|
50
|
-
zone = xUTM.xpath('./utmzone').text
|
51
|
-
unless zone.empty?
|
52
|
-
hProjection[:gridZone] = zone
|
53
|
-
end
|
54
|
-
if zone.empty?
|
55
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UTM zone number is missing'
|
56
|
-
end
|
57
|
-
|
58
|
-
# + transverse mercator (required)
|
59
|
-
xTransMer = xUTM.xpath('./transmer')
|
60
|
-
unless xTransMer.empty?
|
61
|
-
return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
|
62
|
-
end
|
63
|
-
if xTransMer.empty?
|
64
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UTM transverse mercator definition is missing'
|
65
|
-
end
|
66
|
-
|
45
|
+
return MapGridUtm.unpack(xUTM, hProjection, hResponseObj)
|
67
46
|
end
|
68
47
|
|
69
48
|
# grid system 4.1.2.2.3 (ups) - universal polar stereographic
|
70
|
-
|
71
|
-
unless
|
72
|
-
|
73
|
-
haveGrid = true
|
74
|
-
hProjection[:gridSystem] = 'ups'
|
75
|
-
hProjection[:gridSystemName] = 'Universal Polar Stereographic (UPS)' if gridName.empty?
|
76
|
-
|
77
|
-
# grid system 4.1.2.2.3.1 (upszone) - utm zone number {-60..-1, 1..60} (required)
|
78
|
-
# -> ReferenceSystemParameters.projection.gridZone
|
79
|
-
zone = xUSP.xpath('./upszone').text
|
80
|
-
unless zone.empty?
|
81
|
-
hProjection[:gridZone] = zone
|
82
|
-
end
|
83
|
-
if zone.empty?
|
84
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UPS zone number is missing'
|
85
|
-
end
|
86
|
-
|
87
|
-
# + polar stereographic (required)
|
88
|
-
xPolarS = xUSP.xpath('./polarst')
|
89
|
-
unless xPolarS.empty?
|
90
|
-
return PolarStereoProjection.unpack(xPolarS, hProjection, hResponseObj)
|
91
|
-
end
|
92
|
-
if xPolarS.empty?
|
93
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UPS polar stereographic definition is missing'
|
94
|
-
end
|
95
|
-
|
49
|
+
xUPS = xMapGrid.xpath('./ups')
|
50
|
+
unless xUPS.empty?
|
51
|
+
return MapGridUps.unpack(xUPS, hProjection, hResponseObj)
|
96
52
|
end
|
97
53
|
|
98
54
|
# grid system 4.1.2.2.4 (spcs) - state plane coordinate system
|
99
55
|
xStateP = xMapGrid.xpath('./spcs')
|
100
56
|
unless xStateP.empty?
|
101
|
-
|
102
|
-
hProjection[:gridSystem] = 'spcs'
|
103
|
-
hProjection[:gridSystemName] = 'State Plane Coordinate System (SPCS)' if gridName.empty?
|
104
|
-
|
105
|
-
haveGrid = true
|
106
|
-
# grid system 4.1.2.2.4.1 (spcszone) - state plane zone number {nnnn} (required)
|
107
|
-
# -> ReferenceSystemParameters.projection.gridZone
|
108
|
-
zone = xStateP.xpath('./spcszone').text
|
109
|
-
unless zone.empty?
|
110
|
-
hProjection[:gridZone] = zone
|
111
|
-
end
|
112
|
-
if zone.empty?
|
113
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: state plane zone number is missing'
|
114
|
-
end
|
115
|
-
|
116
|
-
# + [ lambert conformal conic | transverse mercator | oblique mercator | polyconic ] (required)
|
117
|
-
# + lambert conformal conic
|
118
|
-
xLambert = xStateP.xpath('./lambertc')
|
119
|
-
unless xLambert.empty?
|
120
|
-
return LambertConicProjection.unpack(xLambert, hProjection, hResponseObj)
|
121
|
-
end
|
122
|
-
|
123
|
-
# + transverse mercator
|
124
|
-
xTransMer = xStateP.xpath('./transmer')
|
125
|
-
unless xTransMer.empty?
|
126
|
-
return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
|
127
|
-
end
|
128
|
-
|
129
|
-
# + oblique mercator
|
130
|
-
xObliqueM = xStateP.xpath('./obqmerc')
|
131
|
-
unless xObliqueM.empty?
|
132
|
-
return ObliqueMercatorProjection.unpack(xObliqueM, hProjection, hResponseObj)
|
133
|
-
end
|
134
|
-
|
135
|
-
# + polyconic
|
136
|
-
xPolyCon = xStateP.xpath('./polycon')
|
137
|
-
unless xPolyCon.empty?
|
138
|
-
return PolyconicProjection.unpack(xPolyCon, hProjection, hResponseObj)
|
139
|
-
end
|
140
|
-
|
141
|
-
# error message
|
142
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UPS state plane projection definition is missing'
|
143
|
-
|
57
|
+
return MapGridStatePlane.unpack(xStateP, hProjection, hResponseObj)
|
144
58
|
end
|
145
59
|
|
146
60
|
# grid system 4.1.2.2.5 (arcsys) - equal arc-second coordinate system
|
147
61
|
xArc = xMapGrid.xpath('./arcsys')
|
148
62
|
unless xArc.empty?
|
149
|
-
|
150
|
-
haveGrid = true
|
151
|
-
hProjection[:gridSystem] = 'arcsys'
|
152
|
-
hProjection[:gridSystemName] = 'Equal Arc-second Coordinate System (ARC)' if gridName.empty?
|
153
|
-
|
154
|
-
# grid system 4.1.2.2.5.1 (arcszone) - state plane zone number {1..18} (required)
|
155
|
-
# -> ReferenceSystemParameters.projection.gridZone
|
156
|
-
zone = xArc.xpath('./arczone').text
|
157
|
-
unless zone.empty?
|
158
|
-
hProjection[:gridZone] = zone
|
159
|
-
end
|
160
|
-
if zone.empty?
|
161
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: equal arc-second zone number is missing'
|
162
|
-
end
|
163
|
-
|
164
|
-
# + [ equirectangular | azimuthal equidistant ] (required)
|
165
|
-
# + equirectangular
|
166
|
-
xEquiR = xArc.xpath('./equirect')
|
167
|
-
unless xEquiR.empty?
|
168
|
-
return EquirectangularProjection.unpack(xEquiR, hProjection, hResponseObj)
|
169
|
-
end
|
170
|
-
|
171
|
-
# + azimuthal equidistant
|
172
|
-
xAzimuthE = xArc.xpath('./azimequi')
|
173
|
-
unless xAzimuthE.empty?
|
174
|
-
return AzimuthEquidistantProjection.unpack(xAzimuthE, hProjection, hResponseObj)
|
175
|
-
end
|
176
|
-
|
177
|
-
# error message
|
178
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: UPS equal arc-second projection definition is missing'
|
63
|
+
return MapGridEqualArcSecond.unpack(xArc, hProjection, hResponseObj)
|
179
64
|
end
|
180
65
|
|
181
66
|
# grid system 4.1.2.2.6 (othergrd) - other coordinate system {text}
|
182
|
-
# -> ReferenceSystemParameters.projection.
|
67
|
+
# -> ReferenceSystemParameters.projection.gridIdentifier.description
|
183
68
|
otherG = xMapGrid.xpath('./othergrd').text
|
184
69
|
unless otherG.empty?
|
185
|
-
|
186
|
-
haveGrid = true
|
187
|
-
hProjection[:gridSystem] = 'other'
|
188
|
-
hProjection[:gridSystemName] = 'other grid coordinate system' if gridName.empty?
|
189
|
-
|
190
|
-
hProjection[:otherGridDescription] = otherG
|
191
|
-
return hProjection
|
70
|
+
return MapGridOther.unpack(otherG, hProjection)
|
192
71
|
end
|
193
72
|
|
194
73
|
# error message
|
195
|
-
|
196
|
-
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: grid system is missing'
|
197
|
-
end
|
74
|
+
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: grid system is missing'
|
198
75
|
|
199
|
-
return
|
76
|
+
return hProjection
|
200
77
|
|
201
78
|
end
|
202
79
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# unpack fgdc map projection
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-10-03 refactor mdJson projection object
|
5
6
|
# Stan Smith 2017-10-03 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
@@ -41,14 +42,14 @@ module ADIWG
|
|
41
42
|
# instance classes needed in script
|
42
43
|
intMetadataClass = InternalMetadata.new
|
43
44
|
hProjection = intMetadataClass.newProjection
|
45
|
+
hIdentifier = intMetadataClass.newIdentifier
|
46
|
+
hProjection[:projectionIdentifier] = hIdentifier
|
44
47
|
|
45
48
|
# map projection 4.1.2.1.1 (mapprojn) - map projection name (required)
|
46
49
|
# -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
|
47
50
|
name = xMapProjection.xpath('./mapprojn').text
|
48
51
|
unless name.empty?
|
49
|
-
hIdentifier =
|
50
|
-
hIdentifier[:identifier] = name
|
51
|
-
hProjection[:projectionIdentifier] = hIdentifier
|
52
|
+
hIdentifier[:name] = name
|
52
53
|
end
|
53
54
|
if name.empty?
|
54
55
|
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: map projection name is missing'
|
@@ -57,132 +58,176 @@ module ADIWG
|
|
57
58
|
# map projection 4.1.2.1.2 (albers) - Albers Conical Equal Area
|
58
59
|
xAlbers = xMapProjection.xpath('./albers')
|
59
60
|
unless xAlbers.empty?
|
61
|
+
hIdentifier[:identifier] = 'albers'
|
62
|
+
hIdentifier[:name] = 'Albers Conical Equal Area' if name.empty?
|
60
63
|
return AlbersProjection.unpack(xAlbers, hProjection, hResponseObj)
|
61
64
|
end
|
62
65
|
|
63
66
|
# map projection 4.1.2.1.3 (azimequi) - Azimuthal Equidistant
|
64
67
|
xAzimequi = xMapProjection.xpath('./azimequi')
|
65
68
|
unless xAzimequi.empty?
|
69
|
+
hIdentifier[:identifier] = 'azimuthalEquidistant'
|
70
|
+
hIdentifier[:name] = 'Azimuthal Equidistant' if name.empty?
|
66
71
|
return AzimuthEquidistantProjection.unpack(xAzimequi, hProjection, hResponseObj)
|
67
72
|
end
|
68
73
|
|
69
74
|
# map projection 4.1.2.1.4 (equicon) - Equidistant Conic
|
70
75
|
xEquiCon = xMapProjection.xpath('./equicon')
|
71
76
|
unless xEquiCon.empty?
|
77
|
+
hIdentifier[:identifier] = 'equidistantConic'
|
78
|
+
hIdentifier[:name] = 'Equidistant Conic' if name.empty?
|
72
79
|
return EquidistantConicProjection.unpack(xEquiCon, hProjection, hResponseObj)
|
73
80
|
end
|
74
81
|
|
75
82
|
# map projection 4.1.2.1.5 (equirect) - Equirectangular
|
76
83
|
xEquirec = xMapProjection.xpath('./equirect')
|
77
84
|
unless xEquirec.empty?
|
85
|
+
hIdentifier[:identifier] = 'equirectangular'
|
86
|
+
hIdentifier[:name] = 'Equirectangular' if name.empty?
|
78
87
|
return EquirectangularProjection.unpack(xEquirec, hProjection, hResponseObj)
|
79
88
|
end
|
80
89
|
|
81
90
|
# map projection 4.1.2.1.6 (gvnsp) - General Vertical Near-sided Perspective
|
82
91
|
xGenVert = xMapProjection.xpath('./gvnsp')
|
83
92
|
unless xGenVert.empty?
|
93
|
+
hIdentifier[:identifier] = 'generalVertical'
|
94
|
+
hIdentifier[:name] = 'General Vertical Near-sided Perspective' if name.empty?
|
84
95
|
return GeneralVerticalProjection.unpack(xGenVert, hProjection, hResponseObj)
|
85
96
|
end
|
86
97
|
|
87
98
|
# map projection 4.1.2.1.7 (gnomonic) - Gnomonic
|
88
99
|
xGeomonic = xMapProjection.xpath('./gnomonic')
|
89
100
|
unless xGeomonic.empty?
|
101
|
+
hIdentifier[:identifier] = 'gnomonic'
|
102
|
+
hIdentifier[:name] = 'Gnomonic' if name.empty?
|
90
103
|
return GnomonicProjection.unpack(xGeomonic, hProjection, hResponseObj)
|
91
104
|
end
|
92
105
|
|
93
106
|
# map projection 4.1.2.1.8 (lamberta) - Lambert Azimuthal Equal Area
|
94
107
|
xLambertA = xMapProjection.xpath('./lamberta')
|
95
108
|
unless xLambertA.empty?
|
109
|
+
hIdentifier[:identifier] = 'lambertEqualArea'
|
110
|
+
hIdentifier[:name] = 'Lambert Azimuthal Equal Area' if name.empty?
|
96
111
|
return LambertEqualAreaProjection.unpack(xLambertA, hProjection, hResponseObj)
|
97
112
|
end
|
98
113
|
|
99
114
|
# map projection 4.1.2.1.9 (lambertc) - Lambert Conformal Conic
|
100
115
|
xLambertC = xMapProjection.xpath('./lambertc')
|
101
116
|
unless xLambertC.empty?
|
117
|
+
hIdentifier[:identifier] = 'lambertConic'
|
118
|
+
hIdentifier[:name] = 'Lambert Conformal Conic' if name.empty?
|
102
119
|
return LambertConicProjection.unpack(xLambertC, hProjection, hResponseObj)
|
103
120
|
end
|
104
121
|
|
105
122
|
# map projection 4.1.2.1.10 (mercator) - Mercator
|
106
123
|
xMercator = xMapProjection.xpath('./mercator')
|
107
124
|
unless xMercator.empty?
|
125
|
+
hIdentifier[:identifier] = 'mercator'
|
126
|
+
hIdentifier[:name] = 'Mercator' if name.empty?
|
108
127
|
return MercatorProjection.unpack(xMercator, hProjection, hResponseObj)
|
109
128
|
end
|
110
129
|
|
111
130
|
# map projection 4.1.2.1.11 (modsak) - Modified Stereographic for Alaska
|
112
131
|
xAlaska = xMapProjection.xpath('./modsak')
|
113
132
|
unless xAlaska.empty?
|
133
|
+
hIdentifier[:identifier] = 'alaska'
|
134
|
+
hIdentifier[:name] = 'Modified Stereographic for Alaska' if name.empty?
|
114
135
|
return ModifiedAlaskaProjection.unpack(xAlaska, hProjection, hResponseObj)
|
115
136
|
end
|
116
137
|
|
117
138
|
# map projection 4.1.2.1.12 (miller) - Miller Cylindrical
|
118
139
|
xMiller = xMapProjection.xpath('./miller')
|
119
140
|
unless xMiller.empty?
|
141
|
+
hIdentifier[:identifier] = 'miller'
|
142
|
+
hIdentifier[:name] = 'Miller Cylindrical' if name.empty?
|
120
143
|
return MillerCylinderProjection.unpack(xMiller, hProjection, hResponseObj)
|
121
144
|
end
|
122
145
|
|
123
146
|
# map projection 4.1.2.1.13 (obqmerc) - Oblique Mercator
|
124
147
|
xObliqueM = xMapProjection.xpath('./obqmerc')
|
125
148
|
unless xObliqueM.empty?
|
149
|
+
hIdentifier[:identifier] = 'obliqueMercator'
|
150
|
+
hIdentifier[:name] = 'Oblique Mercator' if name.empty?
|
126
151
|
return ObliqueMercatorProjection.unpack(xObliqueM, hProjection, hResponseObj)
|
127
152
|
end
|
128
153
|
|
129
154
|
# map projection 4.1.2.1.14 (orthogr) - Orthographic
|
130
155
|
xOrtho = xMapProjection.xpath('./orthogr')
|
131
156
|
unless xOrtho.empty?
|
157
|
+
hIdentifier[:identifier] = 'orthographic'
|
158
|
+
hIdentifier[:name] = 'Orthographic' if name.empty?
|
132
159
|
return OrthographicProjection.unpack(xOrtho, hProjection, hResponseObj)
|
133
160
|
end
|
134
161
|
|
135
162
|
# map projection 4.1.2.1.15 (polarst) - Polar Stereographic
|
136
163
|
xPolarStereo = xMapProjection.xpath('./polarst')
|
137
164
|
unless xPolarStereo.empty?
|
165
|
+
hIdentifier[:identifier] = 'polarStereo'
|
166
|
+
hIdentifier[:name] = 'Polar Stereographic' if name.empty?
|
138
167
|
return PolarStereoProjection.unpack(xPolarStereo, hProjection, hResponseObj)
|
139
168
|
end
|
140
169
|
|
141
170
|
# map projection 4.1.2.1.16 (polycon) - Polyconic
|
142
171
|
xPolycon = xMapProjection.xpath('./polycon')
|
143
172
|
unless xPolycon.empty?
|
173
|
+
hIdentifier[:identifier] = 'polyconic'
|
174
|
+
hIdentifier[:name] = 'Polyconic' if name.empty?
|
144
175
|
return PolyconicProjection.unpack(xPolycon, hProjection, hResponseObj)
|
145
176
|
end
|
146
177
|
|
147
178
|
# map projection 4.1.2.1.17 (robinson) - Robinson
|
148
179
|
xRobin = xMapProjection.xpath('./robinson')
|
149
180
|
unless xRobin.empty?
|
181
|
+
hIdentifier[:identifier] = 'robinson'
|
182
|
+
hIdentifier[:name] = 'Robinson' if name.empty?
|
150
183
|
return RobinsonProjection.unpack(xRobin, hProjection, hResponseObj)
|
151
184
|
end
|
152
185
|
|
153
186
|
# map projection 4.1.2.1.18 (sinusoid) - Sinusoidal
|
154
187
|
xSinu = xMapProjection.xpath('./sinusoid')
|
155
188
|
unless xSinu.empty?
|
189
|
+
hIdentifier[:identifier] = 'sinusoidal'
|
190
|
+
hIdentifier[:name] = 'Sinusoidal' if name.empty?
|
156
191
|
return SinusoidalProjection.unpack(xSinu, hProjection, hResponseObj)
|
157
192
|
end
|
158
193
|
|
159
194
|
# map projection 4.1.2.1.19 (spaceobq) - Space Oblique Mercator (Landsat)
|
160
195
|
xSpaceO = xMapProjection.xpath('./spaceobq')
|
161
196
|
unless xSpaceO.empty?
|
197
|
+
hIdentifier[:identifier] = 'spaceOblique'
|
198
|
+
hIdentifier[:name] = 'Space Oblique Mercator (Landsat)' if name.empty?
|
162
199
|
return SpaceObliqueProjection.unpack(xSpaceO, hProjection, hResponseObj)
|
163
200
|
end
|
164
201
|
|
165
202
|
# map projection 4.1.2.1.20 (stereo) - Stereographic
|
166
203
|
xStereo = xMapProjection.xpath('./stereo')
|
167
204
|
unless xStereo.empty?
|
205
|
+
hIdentifier[:identifier] = 'stereographic'
|
206
|
+
hIdentifier[:name] = 'Stereographic' if name.empty?
|
168
207
|
return StereographicProjection.unpack(xStereo, hProjection, hResponseObj)
|
169
208
|
end
|
170
209
|
|
171
210
|
# map projection 4.1.2.1.21 (transmer) - Transverse Mercator
|
172
211
|
xTransMer = xMapProjection.xpath('./transmer')
|
173
212
|
unless xTransMer.empty?
|
213
|
+
hIdentifier[:identifier] = 'transverseMercator'
|
214
|
+
hIdentifier[:name] = 'Transverse Mercator' if name.empty?
|
174
215
|
return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
|
175
216
|
end
|
176
217
|
|
177
218
|
# map projection 4.1.2.1.22 (vdgrin) - van der Grinten
|
178
219
|
xVanDerG = xMapProjection.xpath('./vdgrin')
|
179
220
|
unless xVanDerG.empty?
|
221
|
+
hIdentifier[:identifier] = 'grinten'
|
222
|
+
hIdentifier[:name] = 'Van Der Grinten' if name.empty?
|
180
223
|
return VanDerGrintenProjection.unpack(xVanDerG, hProjection, hResponseObj)
|
181
224
|
end
|
182
225
|
|
183
226
|
# map projection 4.1.2.1.23 (mapprojp) - projection parameter set
|
184
227
|
xParamSet = xMapProjection.xpath('./mapprojp')
|
185
228
|
unless xParamSet.empty?
|
229
|
+
hIdentifier[:identifier] = 'parameters'
|
230
|
+
hIdentifier[:name] = 'Projection Parameters' if name.empty?
|
186
231
|
return ProjectionParameters.unpack(xParamSet, hProjection, hResponseObj)
|
187
232
|
end
|
188
233
|
|
@@ -26,7 +26,8 @@ module ADIWG
|
|
26
26
|
hResourceInfo[:spatialRepresentationTypes] << encoding
|
27
27
|
end
|
28
28
|
if encoding.empty?
|
29
|
-
hResponseObj[:readerExecutionMessages] <<
|
29
|
+
hResponseObj[:readerExecutionMessages] <<
|
30
|
+
'WARNING: FGDC reader: planar coordinate encoding method is missing'
|
30
31
|
end
|
31
32
|
|
32
33
|
haveRep = false
|
@@ -44,7 +45,8 @@ module ADIWG
|
|
44
45
|
hCoordResolution[:abscissaResolutionX] = abscissa.to_f
|
45
46
|
end
|
46
47
|
if abscissa.empty?
|
47
|
-
hResponseObj[:readerExecutionMessages] <<
|
48
|
+
hResponseObj[:readerExecutionMessages] <<
|
49
|
+
'WARNING: FGDC reader: coordinate representation abscissa resolution is missing'
|
48
50
|
end
|
49
51
|
|
50
52
|
# map projection 4.1.2.4.2.2 (ordres) - ordinate resolution (required)
|
@@ -54,7 +56,8 @@ module ADIWG
|
|
54
56
|
hCoordResolution[:ordinateResolutionY] = ordinate.to_f
|
55
57
|
end
|
56
58
|
if ordinate.empty?
|
57
|
-
hResponseObj[:readerExecutionMessages] <<
|
59
|
+
hResponseObj[:readerExecutionMessages] <<
|
60
|
+
'WARNING: FGDC reader: coordinate representation ordinate resolution is missing'
|
58
61
|
end
|
59
62
|
|
60
63
|
# map projection 4.1.2.4.4 (plandu) - planar distance units (required)
|
@@ -64,7 +67,8 @@ module ADIWG
|
|
64
67
|
hCoordResolution[:unitOfMeasure] = distUnits
|
65
68
|
end
|
66
69
|
if distUnits.empty?
|
67
|
-
hResponseObj[:readerExecutionMessages] <<
|
70
|
+
hResponseObj[:readerExecutionMessages] <<
|
71
|
+
'WARNING: FGDC reader: planar distance units are missing'
|
68
72
|
end
|
69
73
|
|
70
74
|
hResolution = intMetadataClass.newSpatialResolution
|
@@ -87,7 +91,8 @@ module ADIWG
|
|
87
91
|
hBDResolution[:distanceResolution] = distRes.to_f
|
88
92
|
end
|
89
93
|
if distRes.empty?
|
90
|
-
hResponseObj[:readerExecutionMessages] <<
|
94
|
+
hResponseObj[:readerExecutionMessages] <<
|
95
|
+
'WARNING: FGDC reader: bearing-distance distance resolution is missing'
|
91
96
|
end
|
92
97
|
|
93
98
|
# map projection 4.1.2.4.4 (plandu) - planar distance units (required)
|
@@ -97,7 +102,8 @@ module ADIWG
|
|
97
102
|
hBDResolution[:distanceUnitOfMeasure] = distUnits
|
98
103
|
end
|
99
104
|
if distUnits.empty?
|
100
|
-
hResponseObj[:readerExecutionMessages] <<
|
105
|
+
hResponseObj[:readerExecutionMessages] <<
|
106
|
+
'WARNING: FGDC reader: bearing-distance distance units is missing'
|
101
107
|
end
|
102
108
|
|
103
109
|
# map projection 4.1.2.4.3.2 (bearres) - bearing resolution (required)
|
@@ -107,7 +113,8 @@ module ADIWG
|
|
107
113
|
hBDResolution[:bearingResolution] = bearingRes.to_f
|
108
114
|
end
|
109
115
|
if bearingRes.empty?
|
110
|
-
hResponseObj[:readerExecutionMessages] <<
|
116
|
+
hResponseObj[:readerExecutionMessages] <<
|
117
|
+
'WARNING: FGDC reader: bearing-distance bearing resolution is missing'
|
111
118
|
end
|
112
119
|
|
113
120
|
# map projection 4.1.2.4.3.3 (bearunit) - bearing units (required)
|
@@ -117,7 +124,8 @@ module ADIWG
|
|
117
124
|
hBDResolution[:bearingUnitsOfMeasure] = bearingUnits
|
118
125
|
end
|
119
126
|
if bearingUnits.empty?
|
120
|
-
hResponseObj[:readerExecutionMessages] <<
|
127
|
+
hResponseObj[:readerExecutionMessages] <<
|
128
|
+
'WARNING: FGDC reader: bearing-distance bearing units is missing'
|
121
129
|
end
|
122
130
|
|
123
131
|
# map projection 4.1.2.4.3.4 (bearrefd) - bearing reference direction (required)
|
@@ -127,7 +135,8 @@ module ADIWG
|
|
127
135
|
hBDResolution[:bearingReferenceDirection] = bearingDirection
|
128
136
|
end
|
129
137
|
if bearingDirection.empty?
|
130
|
-
hResponseObj[:readerExecutionMessages] <<
|
138
|
+
hResponseObj[:readerExecutionMessages] <<
|
139
|
+
'WARNING: FGDC reader: bearing-distance bearing direction is missing'
|
131
140
|
end
|
132
141
|
|
133
142
|
# map projection 4.1.2.4.3.5 (bearrefm) - bearing reference meridian (required)
|
@@ -137,9 +146,11 @@ module ADIWG
|
|
137
146
|
hBDResolution[:bearingReferenceMeridian] = bearingMeridian
|
138
147
|
end
|
139
148
|
if bearingMeridian.empty?
|
140
|
-
hResponseObj[:readerExecutionMessages] <<
|
149
|
+
hResponseObj[:readerExecutionMessages] <<
|
150
|
+
'WARNING: FGDC reader: bearing-distance bearing meridian is missing'
|
141
151
|
end
|
142
152
|
|
153
|
+
# packing
|
143
154
|
hResolution = intMetadataClass.newSpatialResolution
|
144
155
|
hResolution[:bearingDistanceResolution] = hBDResolution
|
145
156
|
hResourceInfo[:spatialResolutions] << hResolution
|
@@ -148,7 +159,8 @@ module ADIWG
|
|
148
159
|
|
149
160
|
# error messages
|
150
161
|
unless haveRep
|
151
|
-
hResponseObj[:readerExecutionMessages] <<
|
162
|
+
hResponseObj[:readerExecutionMessages] <<
|
163
|
+
'WARNING: FGDC reader: planar coordinate representation is missing'
|
152
164
|
end
|
153
165
|
|
154
166
|
# map projection 4.1.2.4.4 (plandu) - planar distance units
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# unpack fgdc vertical altitude reference
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-09-26 move altitude datum name to datumIdentifier
|
5
6
|
# Stan Smith 2017-10-19 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
@@ -19,14 +20,16 @@ module ADIWG
|
|
19
20
|
# instance classes needed in script
|
20
21
|
intMetadataClass = InternalMetadata.new
|
21
22
|
hDatum = intMetadataClass.newVerticalDatum
|
23
|
+
hDatumIdentifier = intMetadataClass.newIdentifier
|
22
24
|
|
23
25
|
hDatum[:isDepthSystem] = false
|
24
26
|
|
25
27
|
# altitude datum 4.2.1.1 (altdatum) - altitude datum name (required)
|
26
|
-
# -> referenceSystemParameters.verticalDatum.
|
28
|
+
# -> referenceSystemParameters.verticalDatum.datumIdentifier.identifier
|
27
29
|
datumName = xAltSys.xpath('./altdatum').text
|
28
30
|
unless datumName.empty?
|
29
|
-
|
31
|
+
hDatumIdentifier[:identifier] = datumName
|
32
|
+
hDatum[:datumIdentifier] = hDatumIdentifier
|
30
33
|
end
|
31
34
|
if datumName.empty?
|
32
35
|
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: vertical altitude datum name is missing'
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# unpack fgdc vertical depth reference
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-09-26 move altitude datum name to datumIdentifier
|
5
6
|
# Stan Smith 2017-10-19 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
@@ -19,13 +20,16 @@ module ADIWG
|
|
19
20
|
# instance classes needed in script
|
20
21
|
intMetadataClass = InternalMetadata.new
|
21
22
|
hDatum = intMetadataClass.newVerticalDatum
|
23
|
+
hDatumIdentifier = intMetadataClass.newIdentifier
|
24
|
+
|
22
25
|
hDatum[:isDepthSystem] = true
|
23
26
|
|
24
27
|
# depth datum 4.2.2.1 (depthdn) - depth datum name
|
25
|
-
# -> referenceSystemParameters.verticalDatum.
|
28
|
+
# -> referenceSystemParameters.verticalDatum.datumIdentifier.identifier
|
26
29
|
datumName = xDepthSys.xpath('./depthdn').text
|
27
30
|
unless datumName.empty?
|
28
|
-
|
31
|
+
hDatumIdentifier[:identifier] = datumName
|
32
|
+
hDatum[:datumIdentifier] = hDatumIdentifier
|
29
33
|
end
|
30
34
|
if datumName.empty?
|
31
35
|
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: vertical depth datum name is missing'
|