adiwg-mdtranslator 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +12 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_common.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_parameters.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalPlanar.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +12 -113
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +9 -27
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +27 -15
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_mapLocalSystem.rb → module_mapLocalPlanar.rb} +3 -14
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialReference.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +4 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/{module_verticalReference.rb → module_verticalDatum.rb} +0 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +4 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +95 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +1 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +29 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +8 -23
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +2 -2
- data/lib/adiwg/mdtranslator/version.rb +4 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +6 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +18 -5
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +56 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +45 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +167 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapProjection.rb +374 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +372 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +134 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +8 -11
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +120 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +12 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geodeticParameters.rb +85 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +36 -15
- data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +1 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +7 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +21 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +332 -321
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geodeticParameters.rb +34 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_projectionParameters.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReference.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_spatialReferenceParameters.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +1 -1
- metadata +20 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_ellipsoid.rb +0 -78
- data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +0 -68
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_ellipsoidParameters.rb +0 -32
@@ -0,0 +1,57 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc horizontal data geographic resolution
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-29 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 GeographicResolution
|
16
|
+
|
17
|
+
def self.unpack(xGeographic)
|
18
|
+
|
19
|
+
# instance classes needed in script
|
20
|
+
intMetadataClass = InternalMetadata.new
|
21
|
+
|
22
|
+
hResolution = intMetadataClass.newSpatialResolution
|
23
|
+
hGeoResolution = intMetadataClass.newGeographicResolution
|
24
|
+
|
25
|
+
# geographic reference 4.1.1.1 (latres) - latitude resolution
|
26
|
+
# -> spatialResolution.geographicResolution.latitudeResolution
|
27
|
+
latResolution = xGeographic.xpath('./latres').text
|
28
|
+
unless latResolution.empty?
|
29
|
+
hGeoResolution[:latitudeResolution] = latResolution.to_f
|
30
|
+
end
|
31
|
+
|
32
|
+
# geographic reference 4.1.1.2 (longres) - longitude resolution
|
33
|
+
# -> spatialResolution.geographicResolution.longitudeResolution
|
34
|
+
longResolution = xGeographic.xpath('./longres').text
|
35
|
+
unless longResolution.empty?
|
36
|
+
hGeoResolution[:longitudeResolution] = longResolution.to_f
|
37
|
+
end
|
38
|
+
|
39
|
+
# geographic reference 4.1.1.3 (geogunit) - latitude/longitude units
|
40
|
+
# -> spatialResolution.geographicResolution.unitOfMeasure
|
41
|
+
unitMeasure = xGeographic.xpath('./geogunit').text
|
42
|
+
unless unitMeasure.empty?
|
43
|
+
hGeoResolution[:unitOfMeasure] = unitMeasure
|
44
|
+
end
|
45
|
+
|
46
|
+
hResolution[:geographicResolution] = hGeoResolution
|
47
|
+
|
48
|
+
return hResolution
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -8,7 +8,7 @@ require 'nokogiri'
|
|
8
8
|
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
9
|
require_relative 'module_mapProjection'
|
10
10
|
require_relative 'module_mapGridSystem'
|
11
|
-
require_relative '
|
11
|
+
require_relative 'module_mapLocalPlanar'
|
12
12
|
require_relative 'module_mapCoordinateInfo'
|
13
13
|
|
14
14
|
module ADIWG
|
@@ -49,7 +49,7 @@ module ADIWG
|
|
49
49
|
# planar reference 4.1.2.3 (localp) - local planar
|
50
50
|
xMapLocal = xPlanar.xpath('./localp')
|
51
51
|
unless xMapLocal.empty?
|
52
|
-
hProjection =
|
52
|
+
hProjection = MapLocalPlanar.unpack(xMapLocal, hResponseObj)
|
53
53
|
end
|
54
54
|
|
55
55
|
unless hProjection.nil?
|
@@ -5,8 +5,10 @@
|
|
5
5
|
# Stan Smith 2017-10-02 original script
|
6
6
|
|
7
7
|
require 'nokogiri'
|
8
|
-
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
8
|
require_relative 'module_horizontalPlanar'
|
9
|
+
require_relative 'module_geographicResolution'
|
10
|
+
require_relative 'module_geodeticReference'
|
11
|
+
require_relative 'module_localSystem'
|
10
12
|
|
11
13
|
module ADIWG
|
12
14
|
module Mdtranslator
|
@@ -17,46 +19,13 @@ module ADIWG
|
|
17
19
|
|
18
20
|
def self.unpack(xHorizontalRef, hResourceInfo, hResponseObj)
|
19
21
|
|
20
|
-
#
|
21
|
-
intMetadataClass = InternalMetadata.new
|
22
|
-
|
23
|
-
# horizontal reference 4.1.1 (geograph) - geographic coordinate system
|
22
|
+
# horizontal reference 4.1.1 (geograph) - geographic resolution
|
24
23
|
xGeographic = xHorizontalRef.xpath('./geograph')
|
25
24
|
unless xGeographic.empty?
|
26
|
-
|
27
|
-
hResolution
|
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
|
25
|
+
hResolution = GeographicResolution.unpack(xGeographic)
|
26
|
+
unless hResolution.nil?
|
57
27
|
hResourceInfo[:spatialResolutions] << hResolution
|
58
28
|
end
|
59
|
-
|
60
29
|
end
|
61
30
|
|
62
31
|
# horizontal reference 4.1.2 (planar) - planar coordinate system []
|
@@ -70,89 +39,19 @@ module ADIWG
|
|
70
39
|
# horizontal reference 4.1.3 (local) - local coordinate system
|
71
40
|
xLocal = xHorizontalRef.xpath('./local')
|
72
41
|
unless xLocal.empty?
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
42
|
+
hReferenceSystem = LocalSystem.unpack(xLocal)
|
43
|
+
unless hReferenceSystem.nil?
|
44
|
+
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
89
45
|
end
|
90
|
-
|
91
|
-
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
92
|
-
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
93
|
-
hSystemParameters[:projection] = hProjection
|
94
|
-
hReferenceSystem[:systemParameterSet] = hSystemParameters
|
95
|
-
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
96
|
-
|
97
46
|
end
|
98
47
|
|
99
48
|
# horizontal reference 4.1.4 (geodetic) - parameters for shape of earth
|
100
49
|
xGeodetic = xHorizontalRef.xpath('./geodetic')
|
101
50
|
unless xGeodetic.empty?
|
102
|
-
|
103
|
-
|
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
|
51
|
+
hReferenceSystem = GeodeticReference.unpack(xHorizontalRef)
|
52
|
+
unless hReferenceSystem.nil?
|
53
|
+
hResourceInfo[:spatialReferenceSystems] << hReferenceSystem
|
141
54
|
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
55
|
end
|
157
56
|
|
158
57
|
return hResourceInfo
|
@@ -35,6 +35,9 @@ module ADIWG
|
|
35
35
|
hCitation = intMetadataClass.newCitation
|
36
36
|
hCitation[:title] = thesaurus
|
37
37
|
hKeyword[:thesaurus] = hCitation
|
38
|
+
if thesaurus == 'ISO 19115 Topic Category'
|
39
|
+
hKeyword[:keywordType] = 'isoTopicCategory'
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
43
|
# theme keyword 1.6.1.2 (themekey) - theme keyword keyword {keywordObject}
|
@@ -50,18 +53,7 @@ module ADIWG
|
|
50
53
|
end
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
|
-
# also convert to ISO topic categories
|
55
|
-
if hKeyword[:thesaurus][:title] == 'ISO 19115 Topic Category'
|
56
|
-
hKeyword[:keywords].each do |hKeyObj|
|
57
|
-
hResourceInfo[:topicCategories] << hKeyObj[:keyword]
|
58
|
-
end
|
59
|
-
hKeyword = {}
|
60
|
-
end
|
61
|
-
|
62
|
-
unless hKeyword.empty?
|
63
|
-
aKeywords << hKeyword
|
64
|
-
end
|
56
|
+
aKeywords << hKeyword
|
65
57
|
|
66
58
|
end
|
67
59
|
end
|
@@ -94,9 +86,7 @@ module ADIWG
|
|
94
86
|
end
|
95
87
|
end
|
96
88
|
|
97
|
-
|
98
|
-
aKeywords << hKeyword
|
99
|
-
end
|
89
|
+
aKeywords << hKeyword
|
100
90
|
|
101
91
|
end
|
102
92
|
end
|
@@ -129,9 +119,7 @@ module ADIWG
|
|
129
119
|
end
|
130
120
|
end
|
131
121
|
|
132
|
-
|
133
|
-
aKeywords << hKeyword
|
134
|
-
end
|
122
|
+
aKeywords << hKeyword
|
135
123
|
|
136
124
|
end
|
137
125
|
end
|
@@ -164,9 +152,7 @@ module ADIWG
|
|
164
152
|
end
|
165
153
|
end
|
166
154
|
|
167
|
-
|
168
|
-
aKeywords << hKeyword
|
169
|
-
end
|
155
|
+
aKeywords << hKeyword
|
170
156
|
|
171
157
|
end
|
172
158
|
end
|
@@ -198,9 +184,7 @@ module ADIWG
|
|
198
184
|
end
|
199
185
|
end
|
200
186
|
|
201
|
-
|
202
|
-
aKeywords << hKeyword
|
203
|
-
end
|
187
|
+
aKeywords << hKeyword
|
204
188
|
|
205
189
|
end
|
206
190
|
|
@@ -231,9 +215,7 @@ module ADIWG
|
|
231
215
|
end
|
232
216
|
end
|
233
217
|
|
234
|
-
|
235
|
-
aKeywords << hKeyword
|
236
|
-
end
|
218
|
+
aKeywords << hKeyword
|
237
219
|
|
238
220
|
end
|
239
221
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc horizontal data local reference
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-29 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 LocalSystem
|
16
|
+
|
17
|
+
def self.unpack(xLocal)
|
18
|
+
|
19
|
+
# instance classes needed in script
|
20
|
+
intMetadataClass = InternalMetadata.new
|
21
|
+
|
22
|
+
hProjection = intMetadataClass.newProjection
|
23
|
+
hProjection[:projectionName] = 'local'
|
24
|
+
|
25
|
+
# local planar 4.1.3.1 (localdes) - local description
|
26
|
+
# -> referenceSystemParameters.projection.localPlanarDescription
|
27
|
+
description = xLocal.xpath('./localdes').text
|
28
|
+
unless description.empty?
|
29
|
+
hProjection[:localPlanarDescription] = description
|
30
|
+
end
|
31
|
+
|
32
|
+
# local planar 4.1.3.2 (localgeo) - local georeference information
|
33
|
+
# -> referenceSystemParameters.projection.localPlanarGeoreference
|
34
|
+
georeference = xLocal.xpath('./localgeo').text
|
35
|
+
unless georeference.empty?
|
36
|
+
hProjection[:localPlanarGeoreference] = georeference
|
37
|
+
end
|
38
|
+
|
39
|
+
hReferenceSystem = intMetadataClass.newSpatialReferenceSystem
|
40
|
+
hSystemParameters = intMetadataClass.newReferenceSystemParameterSet
|
41
|
+
hSystemParameters[:projection] = hProjection
|
42
|
+
hReferenceSystem[:systemParameterSet] = hSystemParameters
|
43
|
+
|
44
|
+
return hReferenceSystem
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -113,6 +113,7 @@ module ADIWG
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# map projection 4.1.2.4.4 (plandu) - planar distance units
|
116
|
+
# handled in sections coordinateResolution and bearingDistanceResolution sections above
|
116
117
|
# -> resourceInfo.spatialResolutions.spatialResolution.bearingDistanceResolution.distanceUnitOfMeasure
|
117
118
|
# -> resourceInfo.spatialResolutions.spatialResolution.coordinateResolution.unitOfMeasure
|
118
119
|
|
@@ -5,7 +5,6 @@
|
|
5
5
|
# Stan Smith 2017-10-04 original script
|
6
6
|
|
7
7
|
require 'nokogiri'
|
8
|
-
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
8
|
require_relative 'mapProjections/projection_transverseMercator'
|
10
9
|
require_relative 'mapProjections/projection_polarStereo'
|
11
10
|
require_relative 'mapProjections/projection_lambertConic'
|
@@ -29,22 +28,23 @@ module ADIWG
|
|
29
28
|
|
30
29
|
# grid system 4.1.2.2.1 (gridsysn) - grid coordinate system name
|
31
30
|
# -> ReferenceSystemParameters.projection.projectionIdentifier.identifier
|
32
|
-
|
33
|
-
unless
|
34
|
-
|
35
|
-
hIdentifier[:identifier] = name
|
36
|
-
hProjection[:projectionIdentifier] = hIdentifier
|
31
|
+
gridName = xMapGrid.xpath('./gridsysn').text
|
32
|
+
unless gridName.empty?
|
33
|
+
hProjection[:gridSystemName] = gridName
|
37
34
|
end
|
38
35
|
|
39
36
|
# grid system 4.1.2.2.2 (utm) - universal transverse mercator
|
40
37
|
xUTM = xMapGrid.xpath('./utm')
|
41
38
|
unless xUTM.empty?
|
42
39
|
|
40
|
+
hProjection[:gridSystem] = 'utm'
|
41
|
+
hProjection[:gridSystemName] = 'Universal Transverse Mercator (UTM)' if gridName.empty?
|
42
|
+
|
43
43
|
# grid system 4.1.2.2.2.1 (utmzone) - utm zone number {-60..-1, 1..60}
|
44
|
-
# -> ReferenceSystemParameters.projection.
|
44
|
+
# -> ReferenceSystemParameters.projection.gridZone
|
45
45
|
zone = xUTM.xpath('./utmzone').text
|
46
46
|
unless zone.empty?
|
47
|
-
hProjection[:
|
47
|
+
hProjection[:gridZone] = zone
|
48
48
|
end
|
49
49
|
|
50
50
|
# + transverse mercator
|
@@ -59,11 +59,14 @@ module ADIWG
|
|
59
59
|
xUSP = xMapGrid.xpath('./ups')
|
60
60
|
unless xUSP.empty?
|
61
61
|
|
62
|
+
hProjection[:gridSystem] = 'ups'
|
63
|
+
hProjection[:gridSystemName] = 'Universal Polar Stereographic (UPS)' if gridName.empty?
|
64
|
+
|
62
65
|
# grid system 4.1.2.2.3.1 (upszone) - utm zone number {-60..-1, 1..60}
|
63
|
-
# -> ReferenceSystemParameters.projection.
|
66
|
+
# -> ReferenceSystemParameters.projection.gridZone
|
64
67
|
zone = xUSP.xpath('./upszone').text
|
65
68
|
unless zone.empty?
|
66
|
-
hProjection[:
|
69
|
+
hProjection[:gridZone] = zone
|
67
70
|
end
|
68
71
|
|
69
72
|
# + polar stereographic
|
@@ -78,11 +81,14 @@ module ADIWG
|
|
78
81
|
xStateP = xMapGrid.xpath('./spcs')
|
79
82
|
unless xStateP.empty?
|
80
83
|
|
84
|
+
hProjection[:gridSystem] = 'spcs'
|
85
|
+
hProjection[:gridSystemName] = 'State Plane Coordinate System (SPCS)' if gridName.empty?
|
86
|
+
|
81
87
|
# grid system 4.1.2.2.4.1 (spcszone) - state plane zone number {nnnn}
|
82
|
-
# -> ReferenceSystemParameters.projection.
|
88
|
+
# -> ReferenceSystemParameters.projection.gridZone
|
83
89
|
zone = xStateP.xpath('./spcszone').text
|
84
90
|
unless zone.empty?
|
85
|
-
hProjection[:
|
91
|
+
hProjection[:gridZone] = zone
|
86
92
|
end
|
87
93
|
|
88
94
|
# + [ lambert conformal conic | transverse mercator | oblique mercator | polyconic ]
|
@@ -116,11 +122,14 @@ module ADIWG
|
|
116
122
|
xArc = xMapGrid.xpath('./arcsys')
|
117
123
|
unless xArc.empty?
|
118
124
|
|
125
|
+
hProjection[:gridSystem] = 'arcsys'
|
126
|
+
hProjection[:gridSystemName] = 'Equal Arc-second Coordinate System (ARC)' if gridName.empty?
|
127
|
+
|
119
128
|
# grid system 4.1.2.2.5.1 (arcszone) - state plane zone number {1..18}
|
120
|
-
# -> ReferenceSystemParameters.projection.
|
129
|
+
# -> ReferenceSystemParameters.projection.gridZone
|
121
130
|
zone = xArc.xpath('./arczone').text
|
122
131
|
unless zone.empty?
|
123
|
-
hProjection[:
|
132
|
+
hProjection[:gridZone] = zone
|
124
133
|
end
|
125
134
|
|
126
135
|
# + [ equirectangular | azimuthal equidistant ]
|
@@ -142,8 +151,11 @@ module ADIWG
|
|
142
151
|
# -> ReferenceSystemParameters.projection.otherGridDescription
|
143
152
|
otherG = xMapGrid.xpath('./othergrd').text
|
144
153
|
unless otherG.empty?
|
154
|
+
|
155
|
+
hProjection[:gridSystem] = 'other'
|
156
|
+
hProjection[:gridSystemName] = 'other grid coordinate system' if gridName.empty?
|
157
|
+
|
145
158
|
hProjection[:otherGridDescription] = otherG
|
146
|
-
hProjection[:projectionName] = 'other grid system'
|
147
159
|
return hProjection
|
148
160
|
end
|
149
161
|
|