adiwg-mdtranslator 2.3.5 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +49 -8
  3. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +57 -0
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +53 -0
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +252 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +56 -0
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +53 -0
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +57 -0
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +53 -0
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +57 -0
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +53 -0
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +58 -0
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +50 -0
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +47 -0
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +61 -0
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +53 -0
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +91 -0
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +60 -0
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +53 -0
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +50 -0
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +50 -0
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +53 -0
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +53 -0
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +54 -0
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +48 -0
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +4 -4
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +81 -0
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +167 -0
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +128 -0
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +159 -0
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalSystem.rb +59 -0
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +195 -0
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb +15 -1
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +68 -0
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +68 -0
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalReference.rb +48 -0
  37. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +5 -3
  38. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +96 -0
  39. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +126 -126
  40. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +66 -0
  41. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_ellipsoid.rb +78 -0
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +66 -0
  43. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +55 -0
  44. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +237 -0
  45. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +69 -0
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +57 -42
  47. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +101 -51
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +89 -0
  49. data/lib/adiwg/mdtranslator/version.rb +7 -1
  50. data/lib/adiwg/mdtranslator/writers/html/sections/html_bearingDistanceResolution.rb +68 -0
  51. data/lib/adiwg/mdtranslator/writers/html/sections/html_coordinateResolution.rb +47 -0
  52. data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicResolution.rb +47 -0
  53. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +48 -7
  54. data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +2 -2
  55. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialResolution.rb +95 -0
  56. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb +32 -0
  57. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coordinateResolution.rb +29 -0
  58. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_ellipsoidParameters.rb +32 -0
  59. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicResolution.rb +29 -0
  60. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_obliqueLinePoint.rb +28 -0
  61. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +57 -0
  62. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReference.rb +2 -0
  63. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReferenceParameters.rb +32 -0
  64. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialResolution.rb +16 -1
  65. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +32 -0
  66. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_parentId.rb +5 -8
  67. metadata +55 -4
  68. data/lib/adiwg/mdtranslator/writers/html/sections/html_resolution.rb +0 -54
@@ -0,0 +1,128 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc planar coordinate information
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-05 original script
6
+
7
+ require 'nokogiri'
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Readers
13
+ module Fgdc
14
+
15
+ module PlanarCoordinateInformation
16
+
17
+ def self.unpack(xPlanarCI, hResourceInfo, hResponseObj)
18
+
19
+ # instance classes needed in script
20
+ intMetadataClass = InternalMetadata.new
21
+
22
+ # map projection 4.1.2.4.1 (plance) - planar coordinate encoding method
23
+ # -> resourceInfo.spatialRepresentationTypes
24
+ encoding = xPlanarCI.xpath('./plance').text
25
+ unless encoding.empty?
26
+ hResourceInfo[:spatialRepresentationTypes] << encoding
27
+ end
28
+
29
+ # map projection 4.1.2.4.2 (coordrep) - coordinate representation
30
+ xCoordRep = xPlanarCI.xpath('./coordrep')
31
+ unless xCoordRep.empty?
32
+
33
+ hCoordResolution = intMetadataClass.newCoordinateResolution
34
+
35
+ # map projection 4.1.2.4.2.1 (absres) - abscissa resolution
36
+ # -> resourceInfo.spatialResolutions.spatialResolution.coordinateResolution.abscissaResolutionX
37
+ abscissa = xCoordRep.xpath('./absres').text
38
+ unless abscissa.empty?
39
+ hCoordResolution[:abscissaResolutionX] = abscissa.to_f
40
+ end
41
+
42
+ # map projection 4.1.2.4.2.2 (ordres) - ordinate resolution
43
+ # -> resourceInfo.spatialResolutions.spatialResolution.coordinateResolution.ordinateResolutionY
44
+ ordinate = xCoordRep.xpath('./ordres').text
45
+ unless ordinate.empty?
46
+ hCoordResolution[:ordinateResolutionY] = ordinate.to_f
47
+ end
48
+
49
+ # map projection 4.1.2.4.4 (plandu) - planar distance units
50
+ # -> resourceInfo.spatialResolutions.spatialResolution.coordinateResolution.unitOfMeasure
51
+ distUnits = xPlanarCI.xpath('./plandu').text
52
+ unless distUnits.empty?
53
+ hCoordResolution[:unitOfMeasure] = distUnits
54
+ end
55
+
56
+ hResolution = intMetadataClass.newSpatialResolution
57
+ hResolution[:coordinateResolution] = hCoordResolution
58
+ hResourceInfo[:spatialResolutions] << hResolution
59
+
60
+ end
61
+
62
+ # map projection 4.1.2.4.3 (distbrep) - distance and bearing representation
63
+ xBDRep = xPlanarCI.xpath('./distbrep')
64
+ unless xBDRep.empty?
65
+
66
+ hBDResolution = intMetadataClass.newBearingDistanceResolution
67
+
68
+ # map projection 4.1.2.4.3.1 (distres) - distance resolution
69
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.distanceResolution
70
+ distRes = xBDRep.xpath('./distres').text
71
+ unless distRes.empty?
72
+ hBDResolution[:distanceResolution] = distRes.to_f
73
+ end
74
+
75
+ # map projection 4.1.2.4.4 (plandu) - planar distance units
76
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.distanceUnitOfMeasure
77
+ distUnits = xPlanarCI.xpath('./plandu').text
78
+ unless distUnits.empty?
79
+ hBDResolution[:distanceUnitOfMeasure] = distUnits
80
+ end
81
+ # map projection 4.1.2.4.3.2 (bearres) - bearing resolution
82
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.bearingResolution
83
+ bearingRes = xBDRep.xpath('./bearres').text
84
+ unless bearingRes.empty?
85
+ hBDResolution[:bearingResolution] = bearingRes.to_f
86
+ end
87
+
88
+ # map projection 4.1.2.4.3.3 (bearunit) - bearing units
89
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.bearingUnitsOfMeasure
90
+ bearingUnits = xBDRep.xpath('./bearunit').text
91
+ unless bearingUnits.empty?
92
+ hBDResolution[:bearingUnitsOfMeasure] = bearingUnits
93
+ end
94
+
95
+ # map projection 4.1.2.4.3.4 (bearrefd) - bearing reference direction
96
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.bearingReferenceDirection
97
+ bearingDirection = xBDRep.xpath('./bearrefd').text
98
+ unless bearingDirection.empty?
99
+ hBDResolution[:bearingReferenceDirection] = bearingDirection
100
+ end
101
+
102
+ # map projection 4.1.2.4.3.5 (bearrefm) - bearing reference meridian
103
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.bearingReferenceMeridian
104
+ bearingMeridian = xBDRep.xpath('./bearrefm').text
105
+ unless bearingMeridian.empty?
106
+ hBDResolution[:bearingReferenceMeridian] = bearingMeridian
107
+ end
108
+
109
+ hResolution = intMetadataClass.newSpatialResolution
110
+ hResolution[:bearingDistanceResolution] = hBDResolution
111
+ hResourceInfo[:spatialResolutions] << hResolution
112
+
113
+ end
114
+
115
+ # map projection 4.1.2.4.4 (plandu) - planar distance units
116
+ # -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.distanceUnitOfMeasure
117
+ # -> resourceInfo.spatialResolutions.spatialResolution.coordinateResolution.unitOfMeasure
118
+
119
+ return nil
120
+
121
+ end
122
+
123
+ end
124
+
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,159 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc map grid coordinate system
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-04 original script
6
+
7
+ require 'nokogiri'
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+ require_relative 'mapProjections/projection_transverseMercator'
10
+ require_relative 'mapProjections/projection_polarStereo'
11
+ require_relative 'mapProjections/projection_lambertConic'
12
+ require_relative 'mapProjections/projection_obliqueMercator'
13
+ require_relative 'mapProjections/projection_polyconic'
14
+ require_relative 'mapProjections/projection_equirectangular'
15
+ require_relative 'mapProjections/projection_azimuthEquidistant'
16
+
17
+ module ADIWG
18
+ module Mdtranslator
19
+ module Readers
20
+ module Fgdc
21
+
22
+ module MapGridSystem
23
+
24
+ def self.unpack(xMapGrid, hResponseObj)
25
+
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ hProjection = intMetadataClass.newProjection
29
+
30
+ # grid system 4.1.2.2.1 (gridsysn) - grid coordinate system name
31
+ # -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
32
+ name = xMapGrid.xpath('./gridsysn').text
33
+ unless name.empty?
34
+ hIdentifier = intMetadataClass.newIdentifier
35
+ hIdentifier[:identifier] = name
36
+ hProjection[:projectionIdentifier] = hIdentifier
37
+ end
38
+
39
+ # grid system 4.1.2.2.2 (utm) - universal transverse mercator
40
+ xUTM = xMapGrid.xpath('./utm')
41
+ unless xUTM.empty?
42
+
43
+ # grid system 4.1.2.2.2.1 (utmzone) - utm zone number {-60..-1, 1..60}
44
+ # -> ReferenceSystemParameters.projection.zone
45
+ zone = xUTM.xpath('./utmzone').text
46
+ unless zone.empty?
47
+ hProjection[:zone] = zone
48
+ end
49
+
50
+ # + transverse mercator
51
+ xTransMer = xUTM.xpath('./transmer')
52
+ unless xTransMer.empty?
53
+ return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
54
+ end
55
+
56
+ end
57
+
58
+ # grid system 4.1.2.2.3 (ups) - universal polar stereographic
59
+ xUSP = xMapGrid.xpath('./ups')
60
+ unless xUSP.empty?
61
+
62
+ # grid system 4.1.2.2.3.1 (upszone) - utm zone number {-60..-1, 1..60}
63
+ # -> ReferenceSystemParameters.projection.zone
64
+ zone = xUSP.xpath('./upszone').text
65
+ unless zone.empty?
66
+ hProjection[:zone] = zone
67
+ end
68
+
69
+ # + polar stereographic
70
+ xPolarS = xUSP.xpath('./polarst')
71
+ unless xPolarS.empty?
72
+ return PolarStereoProjection.unpack(xPolarS, hProjection, hResponseObj)
73
+ end
74
+
75
+ end
76
+
77
+ # grid system 4.1.2.2.4 (spcs) - state plane coordinate system
78
+ xStateP = xMapGrid.xpath('./spcs')
79
+ unless xStateP.empty?
80
+
81
+ # grid system 4.1.2.2.4.1 (spcszone) - state plane zone number {nnnn}
82
+ # -> ReferenceSystemParameters.projection.zone
83
+ zone = xStateP.xpath('./spcszone').text
84
+ unless zone.empty?
85
+ hProjection[:zone] = zone
86
+ end
87
+
88
+ # + [ lambert conformal conic | transverse mercator | oblique mercator | polyconic ]
89
+ # + lambert conformal conic
90
+ xLambert = xStateP.xpath('./lambertc')
91
+ unless xLambert.empty?
92
+ return LambertConicProjection.unpack(xLambert, hProjection, hResponseObj)
93
+ end
94
+
95
+ # + transverse mercator
96
+ xTransMer = xStateP.xpath('./transmer')
97
+ unless xTransMer.empty?
98
+ return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
99
+ end
100
+
101
+ # + oblique mercator
102
+ xObliqueM = xStateP.xpath('./obqmerc')
103
+ unless xObliqueM.empty?
104
+ return ObliqueMercatorProjection.unpack(xObliqueM, hProjection, hResponseObj)
105
+ end
106
+
107
+ # + polyconic
108
+ xPolyCon = xStateP.xpath('./polycon')
109
+ unless xPolyCon.empty?
110
+ return PolyconicProjection.unpack(xPolyCon, hProjection, hResponseObj)
111
+ end
112
+
113
+ end
114
+
115
+ # grid system 4.1.2.2.5 (arcsys) - equal arc-second coordinate system
116
+ xArc = xMapGrid.xpath('./arcsys')
117
+ unless xArc.empty?
118
+
119
+ # grid system 4.1.2.2.5.1 (arcszone) - state plane zone number {1..18}
120
+ # -> ReferenceSystemParameters.projection.zone
121
+ zone = xArc.xpath('./arczone').text
122
+ unless zone.empty?
123
+ hProjection[:zone] = zone
124
+ end
125
+
126
+ # + [ equirectangular | azimuthal equidistant ]
127
+ # + equirectangular
128
+ xEquiR = xArc.xpath('./equirect')
129
+ unless xEquiR.empty?
130
+ return EquirectangularProjection.unpack(xEquiR, hProjection, hResponseObj)
131
+ end
132
+
133
+ # + azimuthal equidistant
134
+ xAzimuthE = xArc.xpath('./azimequi')
135
+ unless xAzimuthE.empty?
136
+ return AzimuthEquidistantProjection.unpack(xAzimuthE, hProjection, hResponseObj)
137
+ end
138
+
139
+ end
140
+
141
+ # grid system 4.1.2.2.6 (othergrd) - other coordinate system {text}
142
+ # -> ReferenceSystemParameters.projection.otherGridDescription
143
+ otherG = xMapGrid.xpath('./othergrd').text
144
+ unless otherG.empty?
145
+ hProjection[:otherGridDescription] = otherG
146
+ hProjection[:projectionName] = 'other grid system'
147
+ return hProjection
148
+ end
149
+
150
+ return nil
151
+
152
+ end
153
+
154
+ end
155
+
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,59 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc map grid coordinate system
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-04 original script
6
+
7
+ require 'nokogiri'
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+ require_relative 'mapProjections/projection_transverseMercator'
10
+ require_relative 'mapProjections/projection_polarStereo'
11
+ require_relative 'mapProjections/projection_lambertConic'
12
+ require_relative 'mapProjections/projection_obliqueMercator'
13
+ require_relative 'mapProjections/projection_polyconic'
14
+ require_relative 'mapProjections/projection_equirectangular'
15
+ require_relative 'mapProjections/projection_azimuthEquidistant'
16
+
17
+ module ADIWG
18
+ module Mdtranslator
19
+ module Readers
20
+ module Fgdc
21
+
22
+ module MapLocalSystem
23
+
24
+ def self.unpack(xMapLocal, hResponseObj)
25
+
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ hProjection = intMetadataClass.newProjection
29
+
30
+ # -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
31
+ hIdentifier = intMetadataClass.newIdentifier
32
+ hIdentifier[:identifier] = 'local planar coordinate system'
33
+ hProjection[:projectionIdentifier] = hIdentifier
34
+ hProjection[:projectionName] = 'local planar'
35
+
36
+ # local planar 4.1.2.3.1 (localpd) - local planar description
37
+ # -> ReferenceSystemParameters.projection.localPlanarDescription
38
+ description = xMapLocal.xpath('./localpd').text
39
+ unless description.empty?
40
+ hProjection[:localPlanarDescription] = description
41
+ end
42
+
43
+ # local planar 4.1.2.3.2 (localpgi) - local planar georeference information
44
+ # -> ReferenceSystemParameters.projection.localPlanarGeoreference
45
+ georeference = xMapLocal.xpath('./localpgi').text
46
+ unless georeference.empty?
47
+ hProjection[:localPlanarGeoreference] = georeference
48
+ end
49
+
50
+ return hProjection
51
+
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,195 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc map projection
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-03 original script
6
+
7
+ require 'nokogiri'
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+ require_relative 'mapProjections/projection_albers'
10
+ require_relative 'mapProjections/projection_azimuthEquidistant'
11
+ require_relative 'mapProjections/projection_equidistantConic'
12
+ require_relative 'mapProjections/projection_equirectangular'
13
+ require_relative 'mapProjections/projection_generalVertical'
14
+ require_relative 'mapProjections/projection_gnomonic'
15
+ require_relative 'mapProjections/projection_lambertEqualArea'
16
+ require_relative 'mapProjections/projection_lambertConic'
17
+ require_relative 'mapProjections/projection_mercator'
18
+ require_relative 'mapProjections/projection_modifiedAlaska'
19
+ require_relative 'mapProjections/projection_millerCylinder'
20
+ require_relative 'mapProjections/projection_obliqueMercator'
21
+ require_relative 'mapProjections/projection_orthographic'
22
+ require_relative 'mapProjections/projection_polarStereo'
23
+ require_relative 'mapProjections/projection_polyconic'
24
+ require_relative 'mapProjections/projection_robinson'
25
+ require_relative 'mapProjections/projection_sinusoidal'
26
+ require_relative 'mapProjections/projection_spaceOblique'
27
+ require_relative 'mapProjections/projection_stereographic'
28
+ require_relative 'mapProjections/projection_transverseMercator'
29
+ require_relative 'mapProjections/projection_vanDerGrinten'
30
+ require_relative 'mapProjections/projection_parameters'
31
+
32
+ module ADIWG
33
+ module Mdtranslator
34
+ module Readers
35
+ module Fgdc
36
+
37
+ module MapProjection
38
+
39
+ def self.unpack(xMapProjection, hResponseObj)
40
+
41
+ # instance classes needed in script
42
+ intMetadataClass = InternalMetadata.new
43
+ hProjection = intMetadataClass.newProjection
44
+
45
+ # map projection 4.1.2.1.1 (mapprojn) - map projection name
46
+ # -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
47
+ name = xMapProjection.xpath('./mapprojn').text
48
+ unless name.empty?
49
+ hIdentifier = intMetadataClass.newIdentifier
50
+ hIdentifier[:identifier] = name
51
+ hProjection[:projectionIdentifier] = hIdentifier
52
+ end
53
+
54
+ # map projection 4.1.2.1.2 (albers) - Albers Conical Equal Area
55
+ xAlbers = xMapProjection.xpath('./albers')
56
+ unless xAlbers.empty?
57
+ return AlbersProjection.unpack(xAlbers, hProjection, hResponseObj)
58
+ end
59
+
60
+ # map projection 4.1.2.1.3 (azimequi) - Azimuthal Equidistant
61
+ xAzimequi = xMapProjection.xpath('./azimequi')
62
+ unless xAzimequi.empty?
63
+ return AzimuthEquidistantProjection.unpack(xAzimequi, hProjection, hResponseObj)
64
+ end
65
+
66
+ # map projection 4.1.2.1.4 (equicon) - Equidistant Conic
67
+ xEquiCon = xMapProjection.xpath('./equicon')
68
+ unless xEquiCon.empty?
69
+ return EquidistantConicProjection.unpack(xEquiCon, hProjection, hResponseObj)
70
+ end
71
+
72
+ # map projection 4.1.2.1.5 (equirect) - Equirectangular
73
+ xEquirec = xMapProjection.xpath('./equirect')
74
+ unless xEquirec.empty?
75
+ return EquirectangularProjection.unpack(xEquirec, hProjection, hResponseObj)
76
+ end
77
+
78
+ # map projection 4.1.2.1.6 (gvnsp) - General Vertical Near-sided Perspective
79
+ xGenVert = xMapProjection.xpath('./gvnsp')
80
+ unless xGenVert.empty?
81
+ return GeneralVerticalProjection.unpack(xGenVert, hProjection, hResponseObj)
82
+ end
83
+
84
+ # map projection 4.1.2.1.7 (gnomonic) - Gnomonic
85
+ xGeomonic = xMapProjection.xpath('./gnomonic')
86
+ unless xGeomonic.empty?
87
+ return GnomonicProjection.unpack(xGeomonic, hProjection, hResponseObj)
88
+ end
89
+
90
+ # map projection 4.1.2.1.8 (lamberta) - Lambert Azimuthal Equal Area
91
+ xLambertA = xMapProjection.xpath('./lamberta')
92
+ unless xLambertA.empty?
93
+ return LambertEqualAreaProjection.unpack(xLambertA, hProjection, hResponseObj)
94
+ end
95
+
96
+ # map projection 4.1.2.1.9 (lambertc) - Lambert Conformal Conic
97
+ xLambertC = xMapProjection.xpath('./lambertc')
98
+ unless xLambertC.empty?
99
+ return LambertConicProjection.unpack(xLambertC, hProjection, hResponseObj)
100
+ end
101
+
102
+ # map projection 4.1.2.1.10 (mercator) - Mercator
103
+ xMercator = xMapProjection.xpath('./mercator')
104
+ unless xMercator.empty?
105
+ return MercatorProjection.unpack(xMercator, hProjection, hResponseObj)
106
+ end
107
+
108
+ # map projection 4.1.2.1.11 (modsak) - Modified Stereographic for Alaska
109
+ xAlaska = xMapProjection.xpath('./modsak')
110
+ unless xAlaska.empty?
111
+ return ModifiedAlaskaProjection.unpack(xAlaska, hProjection, hResponseObj)
112
+ end
113
+
114
+ # map projection 4.1.2.1.12 (miller) - Miller Cylindrical
115
+ xMiller = xMapProjection.xpath('./miller')
116
+ unless xMiller.empty?
117
+ return MillerCylinderProjection.unpack(xMiller, hProjection, hResponseObj)
118
+ end
119
+
120
+ # map projection 4.1.2.1.13 (obqmerc) - Oblique Mercator
121
+ xObliqueM = xMapProjection.xpath('./obqmerc')
122
+ unless xObliqueM.empty?
123
+ return ObliqueMercatorProjection.unpack(xObliqueM, hProjection, hResponseObj)
124
+ end
125
+
126
+ # map projection 4.1.2.1.14 (orthogr) - Orthographic
127
+ xOrtho = xMapProjection.xpath('./orthogr')
128
+ unless xOrtho.empty?
129
+ return OrthographicProjection.unpack(xOrtho, hProjection, hResponseObj)
130
+ end
131
+
132
+ # map projection 4.1.2.1.15 (polarst) - Polar Stereographic
133
+ xPolarStereo = xMapProjection.xpath('./polarst')
134
+ unless xPolarStereo.empty?
135
+ return PolarStereoProjection.unpack(xPolarStereo, hProjection, hResponseObj)
136
+ end
137
+
138
+ # map projection 4.1.2.1.16 (polycon) - Polyconic
139
+ xPolycon = xMapProjection.xpath('./polycon')
140
+ unless xPolycon.empty?
141
+ return PolyconicProjection.unpack(xPolycon, hProjection, hResponseObj)
142
+ end
143
+
144
+ # map projection 4.1.2.1.17 (robinson) - Robinson
145
+ xRobin = xMapProjection.xpath('./robinson')
146
+ unless xRobin.empty?
147
+ return RobinsonProjection.unpack(xRobin, hProjection, hResponseObj)
148
+ end
149
+
150
+ # map projection 4.1.2.1.18 (sinusoid) - Sinusoidal
151
+ xSinu = xMapProjection.xpath('./sinusoid')
152
+ unless xSinu.empty?
153
+ return SinusoidalProjection.unpack(xSinu, hProjection, hResponseObj)
154
+ end
155
+
156
+ # map projection 4.1.2.1.19 (spaceobq) - Space Oblique Mercator (Landsat)
157
+ xSpaceO = xMapProjection.xpath('./spaceobq')
158
+ unless xSpaceO.empty?
159
+ return SpaceObliqueProjection.unpack(xSpaceO, hProjection, hResponseObj)
160
+ end
161
+
162
+ # map projection 4.1.2.1.20 (stereo) - Stereographic
163
+ xStereo = xMapProjection.xpath('./stereo')
164
+ unless xStereo.empty?
165
+ return StereographicProjection.unpack(xStereo, hProjection, hResponseObj)
166
+ end
167
+
168
+ # map projection 4.1.2.1.21 (transmer) - Transverse Mercator
169
+ xTransMer = xMapProjection.xpath('./transmer')
170
+ unless xTransMer.empty?
171
+ return TransverseMercatorProjection.unpack(xTransMer, hProjection, hResponseObj)
172
+ end
173
+
174
+ # map projection 4.1.2.1.22 (vdgrin) - van der Grinten
175
+ xVanDerG = xMapProjection.xpath('./vdgrin')
176
+ unless xVanDerG.empty?
177
+ return VanDerGrintenProjection.unpack(xVanDerG, hProjection, hResponseObj)
178
+ end
179
+
180
+ # map projection 4.1.2.1.23 (mapprojp) - projection parameter set
181
+ xParamSet = xMapProjection.xpath('./mapprojp')
182
+ unless xParamSet.empty?
183
+ return ProjectionParameters.unpack(xParamSet, hProjection, hResponseObj)
184
+ end
185
+
186
+ return nil
187
+
188
+ end
189
+
190
+ end
191
+
192
+ end
193
+ end
194
+ end
195
+ end