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.
- checksums.yaml +4 -4
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +49 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +252 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +58 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +50 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +47 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +91 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +60 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +50 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +50 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +48 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +81 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +167 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +128 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +159 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalSystem.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +195 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb +15 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +68 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +68 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalReference.rb +48 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +96 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +126 -126
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_ellipsoid.rb +78 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +55 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +237 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +57 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +101 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +89 -0
- data/lib/adiwg/mdtranslator/version.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_bearingDistanceResolution.rb +68 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_coordinateResolution.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicResolution.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +48 -7
- data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialResolution.rb +95 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_bearingDistanceResolution.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coordinateResolution.rb +29 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_ellipsoidParameters.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicResolution.rb +29 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_obliqueLinePoint.rb +28 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +57 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReference.rb +2 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReferenceParameters.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialResolution.rb +16 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_parentId.rb +5 -8
- metadata +55 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resolution.rb +0 -54
@@ -0,0 +1,53 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc map projection - space oblique
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-10-18 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'projection_common'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
module SpaceObliqueProjection
|
17
|
+
|
18
|
+
def self.unpack(xParams, hProjection, hResponseObj)
|
19
|
+
|
20
|
+
# map projection 4.1.2.1.19 (spaceobq) - Space Oblique Mercator (Landsat)
|
21
|
+
unless xParams.empty?
|
22
|
+
paramCount = 0
|
23
|
+
hProjection[:projectionName] = 'space oblique'
|
24
|
+
|
25
|
+
# -> ReferenceSystemParameters.projection.landsatNumber
|
26
|
+
paramCount += ProjectionCommon.unpackLandSat(xParams, hProjection, hResponseObj)
|
27
|
+
|
28
|
+
# -> ReferenceSystemParameters.projection.landsatPath
|
29
|
+
paramCount += ProjectionCommon.unpackLandSatPath(xParams, hProjection, hResponseObj)
|
30
|
+
|
31
|
+
# -> ReferenceSystemParameters.projection.falseEasting
|
32
|
+
# -> ReferenceSystemParameters.projection.falseNorthing
|
33
|
+
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)
|
34
|
+
|
35
|
+
# verify parameter count
|
36
|
+
if paramCount == 4
|
37
|
+
return hProjection
|
38
|
+
else
|
39
|
+
hResponseObj[:readerExecutionMessages] << 'space oblique projection is missing one or more parameters'
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
return nil
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc map projection - stereographic
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-10-18 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'projection_common'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
module StereographicProjection
|
17
|
+
|
18
|
+
def self.unpack(xParams, hProjection, hResponseObj)
|
19
|
+
|
20
|
+
# map projection 4.1.2.1.20 (stereo) - Stereographic
|
21
|
+
unless xParams.empty?
|
22
|
+
paramCount = 0
|
23
|
+
hProjection[:projectionName] = 'stereographic'
|
24
|
+
|
25
|
+
# -> ReferenceSystemParameters.projection.longitudeOfProjectionCenter
|
26
|
+
paramCount += ProjectionCommon.unpackLongPC(xParams, hProjection, hResponseObj)
|
27
|
+
|
28
|
+
# -> ReferenceSystemParameters.projection.latitudeOfProjectionCenter
|
29
|
+
paramCount += ProjectionCommon.unpackLatPC(xParams, hProjection, hResponseObj)
|
30
|
+
|
31
|
+
# -> ReferenceSystemParameters.projection.falseEasting
|
32
|
+
# -> ReferenceSystemParameters.projection.falseNorthing
|
33
|
+
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)
|
34
|
+
|
35
|
+
# verify parameter count
|
36
|
+
if paramCount == 4
|
37
|
+
return hProjection
|
38
|
+
else
|
39
|
+
hResponseObj[:readerExecutionMessages] << 'stereographic projection is missing one or more parameters'
|
40
|
+
return nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
return nil
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc map projection - transverse mercator
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-10-04 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 TransverseMercatorProjection
|
16
|
+
|
17
|
+
def self.unpack(xParams, hProjection, hResponseObj)
|
18
|
+
|
19
|
+
# map projection 4.1.2.1.21 (transmer) - Transverse Mercator
|
20
|
+
unless xParams.empty?
|
21
|
+
paramCount = 0
|
22
|
+
hProjection[:projectionName] = 'transverse mercator'
|
23
|
+
|
24
|
+
# -> ReferenceSystemParameters.projection.scaleFactorAtCentralMeridian
|
25
|
+
paramCount += ProjectionCommon.unpackSFCM(xParams, hProjection, hResponseObj)
|
26
|
+
|
27
|
+
# -> ReferenceSystemParameters.projection.longitudeOfCentralMeridian
|
28
|
+
paramCount += ProjectionCommon.unpackLongCM(xParams, hProjection, hResponseObj)
|
29
|
+
|
30
|
+
# -> ReferenceSystemParameters.projection.latitudeOfProjectionOrigin
|
31
|
+
paramCount += ProjectionCommon.unpackLatPO(xParams, hProjection, hResponseObj)
|
32
|
+
|
33
|
+
# -> ReferenceSystemParameters.projection.falseEasting
|
34
|
+
# -> ReferenceSystemParameters.projection.falseNorthing
|
35
|
+
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)
|
36
|
+
|
37
|
+
if paramCount == 5
|
38
|
+
return hProjection
|
39
|
+
else
|
40
|
+
hResponseObj[:readerExecutionMessages] << 'transverse mercator projection is missing one or more parameters'
|
41
|
+
return nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
return nil
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc map projection - van der grinten
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-10-18 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 VanDerGrintenProjection
|
16
|
+
|
17
|
+
def self.unpack(xParams, hProjection, hResponseObj)
|
18
|
+
|
19
|
+
# map projection 4.1.2.1.22 (vdgrin) - van der Grinten
|
20
|
+
unless xParams.empty?
|
21
|
+
paramCount = 0
|
22
|
+
hProjection[:projectionName] = 'van der grinten'
|
23
|
+
|
24
|
+
# -> ReferenceSystemParameters.projection.longitudeOfCentralMeridian
|
25
|
+
paramCount += ProjectionCommon.unpackLongCM(xParams, hProjection, hResponseObj)
|
26
|
+
|
27
|
+
# -> ReferenceSystemParameters.projection.falseEasting
|
28
|
+
# -> ReferenceSystemParameters.projection.falseNorthing
|
29
|
+
paramCount += ProjectionCommon.unpackFalseNE(xParams, hProjection, hResponseObj)
|
30
|
+
|
31
|
+
if paramCount == 3
|
32
|
+
return hProjection
|
33
|
+
else
|
34
|
+
hResponseObj[:readerExecutionMessages] << 'van der grinten projection is missing one or more parameters'
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
return nil
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -69,10 +69,10 @@ module ADIWG
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# metadata (spref 4) - spatial reference
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
xSpatialRef = xMetadata.xpath('./spref')
|
73
|
+
unless xSpatialRef.empty?
|
74
|
+
SpatialReference.unpack(xSpatialRef, hResourceInfo, hResponseObj)
|
75
|
+
end
|
76
76
|
|
77
77
|
# metadata (eainfo 5) - entity and attribute
|
78
78
|
xEntity = xMetadata.xpath('./eainfo')
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc horizontal planar data reference
|
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 'module_mapProjection'
|
10
|
+
require_relative 'module_mapGridSystem'
|
11
|
+
require_relative 'module_mapLocalSystem'
|
12
|
+
require_relative 'module_mapCoordinateInfo'
|
13
|
+
|
14
|
+
module ADIWG
|
15
|
+
module Mdtranslator
|
16
|
+
module Readers
|
17
|
+
module Fgdc
|
18
|
+
|
19
|
+
module PlanarReference
|
20
|
+
|
21
|
+
def self.unpack(xPlanar, hResourceInfo, hResponseObj)
|
22
|
+
|
23
|
+
# instance classes needed in script
|
24
|
+
intMetadataClass = InternalMetadata.new
|
25
|
+
hProjection = nil
|
26
|
+
|
27
|
+
# get distance unit of measure for use in map projections and grid systems
|
28
|
+
distanceUnits = nil
|
29
|
+
xPlanCI = xPlanar.xpath('./planci')
|
30
|
+
unless xPlanCI.empty?
|
31
|
+
planDU = xPlanCI.xpath('./plandu').text
|
32
|
+
unless planDU.empty?
|
33
|
+
distanceUnits = planDU
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# planar reference 4.1.2.1 (mapproj) - map projection
|
38
|
+
xMapProjection = xPlanar.xpath('./mapproj')
|
39
|
+
unless xMapProjection.empty?
|
40
|
+
hProjection = MapProjection.unpack(xMapProjection, hResponseObj)
|
41
|
+
end
|
42
|
+
|
43
|
+
# planar reference 4.1.2.2 (gridsys) - grid coordinate system
|
44
|
+
xMapGrid = xPlanar.xpath('./gridsys')
|
45
|
+
unless xMapGrid.empty?
|
46
|
+
hProjection = MapGridSystem.unpack(xMapGrid, hResponseObj)
|
47
|
+
end
|
48
|
+
|
49
|
+
# planar reference 4.1.2.3 (localp) - local planar
|
50
|
+
xMapLocal = xPlanar.xpath('./localp')
|
51
|
+
unless xMapLocal.empty?
|
52
|
+
hProjection = MapLocalSystem.unpack(xMapLocal, hResponseObj)
|
53
|
+
end
|
54
|
+
|
55
|
+
unless hProjection.nil?
|
56
|
+
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
57
|
+
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
58
|
+
unless distanceUnits.nil?
|
59
|
+
hProjection[:falseEastingNorthingUnits] = distanceUnits
|
60
|
+
end
|
61
|
+
hSystemParameters[:projection] = hProjection
|
62
|
+
hReferenceSystem[:systemParameterSet] = hSystemParameters
|
63
|
+
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
64
|
+
end
|
65
|
+
|
66
|
+
# planar reference 4.1.2.4 (planci) - planar coordinate information
|
67
|
+
xPlanarCI = xPlanar.xpath('./planci')
|
68
|
+
unless xPlanarCI.empty?
|
69
|
+
PlanarCoordinateInformation.unpack(xPlanarCI, hResourceInfo, hResponseObj)
|
70
|
+
end
|
71
|
+
|
72
|
+
return hResourceInfo
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc horizontal data reference
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-10-02 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_horizontalPlanar'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
module HorizontalReference
|
17
|
+
|
18
|
+
def self.unpack(xHorizontalRef, hResourceInfo, hResponseObj)
|
19
|
+
|
20
|
+
# instance classes needed in script
|
21
|
+
intMetadataClass = InternalMetadata.new
|
22
|
+
|
23
|
+
# horizontal reference 4.1.1 (geograph) - geographic coordinate system
|
24
|
+
xGeographic = xHorizontalRef.xpath('./geograph')
|
25
|
+
unless xGeographic.empty?
|
26
|
+
|
27
|
+
hResolution = intMetadataClass.newSpatialResolution
|
28
|
+
hGeoResolution = intMetadataClass.newGeographicResolution
|
29
|
+
hasValue = false
|
30
|
+
|
31
|
+
# geographic reference 4.1.1.1 (latres) - latitude resolution
|
32
|
+
# -> spatialResolution.geographicResolution.latitudeResolution
|
33
|
+
latResolution = xGeographic.xpath('./latres').text
|
34
|
+
unless latResolution.empty?
|
35
|
+
hGeoResolution[:latitudeResolution] = latResolution.to_f
|
36
|
+
hasValue = true
|
37
|
+
end
|
38
|
+
|
39
|
+
# geographic reference 4.1.1.2 (longres) - longitude resolution
|
40
|
+
# -> spatialResolution.geographicResolution.longitudeResolution
|
41
|
+
longResolution = xGeographic.xpath('./longres').text
|
42
|
+
unless longResolution.empty?
|
43
|
+
hGeoResolution[:longitudeResolution] = longResolution.to_f
|
44
|
+
hasValue = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# geographic reference 4.1.1.3 (geogunit) - latitude/longitude units
|
48
|
+
# -> spatialResolution.geographicResolution.unitOfMeasure
|
49
|
+
unitMeasure = xGeographic.xpath('./geogunit').text
|
50
|
+
unless unitMeasure.empty?
|
51
|
+
hGeoResolution[:unitOfMeasure] = unitMeasure
|
52
|
+
hasValue = true
|
53
|
+
end
|
54
|
+
|
55
|
+
if hasValue
|
56
|
+
hResolution[:geographicResolution] = hGeoResolution
|
57
|
+
hResourceInfo[:spatialResolutions] << hResolution
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# horizontal reference 4.1.2 (planar) - planar coordinate system []
|
63
|
+
axPlanar = xHorizontalRef.xpath('./planar')
|
64
|
+
unless axPlanar.empty?
|
65
|
+
axPlanar.each do |xPlanar|
|
66
|
+
PlanarReference.unpack(xPlanar, hResourceInfo, hResponseObj)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# horizontal reference 4.1.3 (local) - local coordinate system
|
71
|
+
xLocal = xHorizontalRef.xpath('./local')
|
72
|
+
unless xLocal.empty?
|
73
|
+
|
74
|
+
hProjection = intMetadataClass.newProjection
|
75
|
+
hProjection[:projectionName] = 'local'
|
76
|
+
|
77
|
+
# local planar 4.1.3.1 (localdes) - local description
|
78
|
+
# -> referenceSystemParameters.projection.localPlanarDescription
|
79
|
+
description = xLocal.xpath('./localdes').text
|
80
|
+
unless description.empty?
|
81
|
+
hProjection[:localPlanarDescription] = description
|
82
|
+
end
|
83
|
+
|
84
|
+
# local planar 4.1.3.2 (localgeo) - local georeference information
|
85
|
+
# -> referenceSystemParameters.projection.localPlanarGeoreference
|
86
|
+
georeference = xLocal.xpath('./localgeo').text
|
87
|
+
unless georeference.empty?
|
88
|
+
hProjection[:localPlanarGeoreference] = georeference
|
89
|
+
end
|
90
|
+
|
91
|
+
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
92
|
+
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
93
|
+
hSystemParameters[:projection] = hProjection
|
94
|
+
hReferenceSystem[:systemParameterSet] = hSystemParameters
|
95
|
+
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
# horizontal reference 4.1.4 (geodetic) - parameters for shape of earth
|
100
|
+
xGeodetic = xHorizontalRef.xpath('./geodetic')
|
101
|
+
unless xGeodetic.empty?
|
102
|
+
|
103
|
+
hEllipsoid = intMetadataClass.newEllipsoid
|
104
|
+
|
105
|
+
# geodetic model 4.1.4.1 (horizdn) - horizontal datum name
|
106
|
+
# -> referenceSystemParameters.datumIdentifier.identifier.identifier
|
107
|
+
datumName = xGeodetic.xpath('./horizdn').text
|
108
|
+
unless datumName.empty?
|
109
|
+
hIdentifier = intMetadataClass.newIdentifier
|
110
|
+
hIdentifier[:identifier] = datumName
|
111
|
+
hEllipsoid[:ellipsoidIdentifier] = hIdentifier
|
112
|
+
end
|
113
|
+
|
114
|
+
# geodetic model 4.1.4.2 (ellips) - ellipsoid name
|
115
|
+
# -> referenceSystemParameters.ellipsoid.ellipsoidName
|
116
|
+
ellipsoidName = xGeodetic.xpath('./ellips').text
|
117
|
+
unless ellipsoidName.empty?
|
118
|
+
hEllipsoid[:ellipsoidName] = ellipsoidName
|
119
|
+
end
|
120
|
+
|
121
|
+
# geodetic model 4.1.4.3 (semiaxis) - semi-major axis
|
122
|
+
# -> referenceSystemParameters.ellipsoid.semiMajorAxis
|
123
|
+
semiAxis = xGeodetic.xpath('./semiaxis').text
|
124
|
+
unless semiAxis.empty?
|
125
|
+
hEllipsoid[:semiMajorAxis] = semiAxis.to_f
|
126
|
+
end
|
127
|
+
|
128
|
+
# geodetic model 4.1.2.4.4 (plandu) - distance units
|
129
|
+
# take value from the first 'planar' section with 'plandu' specified
|
130
|
+
axPlanar = xHorizontalRef.xpath('./planar')
|
131
|
+
unless axPlanar.empty?
|
132
|
+
axPlanar.each do |xPlanar|
|
133
|
+
xPlanCI = xPlanar.xpath('./planci')
|
134
|
+
unless xPlanCI.empty?
|
135
|
+
units = xPlanCI.xpath('./plandu').text
|
136
|
+
unless units.empty?
|
137
|
+
hEllipsoid[:axisUnits] = units
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# geodetic model 4.1.4.4 (denflat) - denominator of flattening ratio
|
144
|
+
# -> referenceSystemParameters.ellipsoid.denominatorOfFlatteningRatio
|
145
|
+
flattening = xGeodetic.xpath('./denflat').text
|
146
|
+
unless flattening.empty?
|
147
|
+
hEllipsoid[:denominatorOfFlatteningRatio] = flattening.to_f
|
148
|
+
end
|
149
|
+
|
150
|
+
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
151
|
+
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
152
|
+
hSystemParameters[:ellipsoid] = hEllipsoid
|
153
|
+
hReferenceSystem[:systemParameterSet] = hSystemParameters
|
154
|
+
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
return hResourceInfo
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|