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,374 @@
|
|
1
|
+
# FGDC <<Class>> MapProjection
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-01-02 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class MapProjection
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
# map projection 4.1.2.1.1 (mapprojn) - projection name (required)
|
20
|
+
def write_name(projectionName)
|
21
|
+
unless projectionName.nil?
|
22
|
+
@xml.tag!('mapprojn', projectionName)
|
23
|
+
end
|
24
|
+
if projectionName.nil?
|
25
|
+
@hResponseObj[:writerPass] = false
|
26
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing projection name'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# map projection 4.1.2.2.1 (gridsysn) - grid system name
|
31
|
+
def write_gridName(gridSystem)
|
32
|
+
unless gridSystem.nil?
|
33
|
+
@xml.tag!('gridsysn', gridSystem)
|
34
|
+
end
|
35
|
+
if gridSystem.nil? && @hResponseObj[:writerShowTag]
|
36
|
+
@xml.tag!('gridsysn')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# map projection (feast) - false easting (required)
|
41
|
+
# map projection (fnorth) - false northing (required)
|
42
|
+
def write_falseNE(hProjection)
|
43
|
+
unless hProjection[:falseEasting].nil?
|
44
|
+
@xml.tag!('feast', hProjection[:falseEasting].to_s)
|
45
|
+
end
|
46
|
+
if hProjection[:falseEasting].nil?
|
47
|
+
@hResponseObj[:writerPass] = false
|
48
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing false easting'
|
49
|
+
end
|
50
|
+
unless hProjection[:falseNorthing].nil?
|
51
|
+
@xml.tag!('fnorth', hProjection[:falseNorthing].to_s)
|
52
|
+
end
|
53
|
+
if hProjection[:falseNorthing].nil?
|
54
|
+
@hResponseObj[:writerPass] = false
|
55
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing false northing'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# map projection (stdparll) - standard parallel (at least one required)
|
60
|
+
def write_standParallel(hProjection)
|
61
|
+
haveParallel = false
|
62
|
+
unless hProjection[:standardParallel1].nil?
|
63
|
+
@xml.tag!('stdparll', hProjection[:standardParallel1].to_s)
|
64
|
+
haveParallel = true
|
65
|
+
end
|
66
|
+
unless hProjection[:standardParallel2].nil?
|
67
|
+
@xml.tag!('stdparll', hProjection[:standardParallel2].to_s)
|
68
|
+
haveParallel = true
|
69
|
+
end
|
70
|
+
unless haveParallel
|
71
|
+
@hResponseObj[:writerPass] = false
|
72
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing standard parallel'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# map projection (longcm) - longitude of central meridian (required)
|
77
|
+
def write_longCM(hProjection)
|
78
|
+
unless hProjection[:longitudeOfCentralMeridian].nil?
|
79
|
+
@xml.tag!('longcm', hProjection[:longitudeOfCentralMeridian].to_s)
|
80
|
+
end
|
81
|
+
if hProjection[:longitudeOfCentralMeridian].nil?
|
82
|
+
@hResponseObj[:writerPass] = false
|
83
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing longitude of central meridian'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# map projection (latprjo) - latitude of projection origin (required)
|
88
|
+
def write_latPO(hProjection)
|
89
|
+
unless hProjection[:latitudeOfProjectionOrigin].nil?
|
90
|
+
@xml.tag!('latprjo', hProjection[:latitudeOfProjectionOrigin].to_s)
|
91
|
+
end
|
92
|
+
if hProjection[:latitudeOfProjectionOrigin].nil?
|
93
|
+
@hResponseObj[:writerPass] = false
|
94
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing latitude of projection origin'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# map projection (heightpt) - height of perspective point above surface (required)
|
99
|
+
def write_heightPP(hProjection)
|
100
|
+
unless hProjection[:heightOfProspectivePointAboveSurface].nil?
|
101
|
+
@xml.tag!('heightpt', hProjection[:heightOfProspectivePointAboveSurface].to_s)
|
102
|
+
end
|
103
|
+
if hProjection[:heightOfProspectivePointAboveSurface].nil?
|
104
|
+
@hResponseObj[:writerPass] = false
|
105
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing height of perspective point above surface'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# map projection (longpc) - longitude of projection center (required)
|
110
|
+
def write_longPC(hProjection)
|
111
|
+
unless hProjection[:longitudeOfProjectionCenter].nil?
|
112
|
+
@xml.tag!('longpc', hProjection[:longitudeOfProjectionCenter].to_s)
|
113
|
+
end
|
114
|
+
if hProjection[:longitudeOfProjectionCenter].nil?
|
115
|
+
@hResponseObj[:writerPass] = false
|
116
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing longitude of projection center'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# map projection (latprjc) - latitude of projection center (required)
|
121
|
+
def write_latPC(hProjection)
|
122
|
+
unless hProjection[:latitudeOfProjectionCenter].nil?
|
123
|
+
@xml.tag!('latprjc', hProjection[:latitudeOfProjectionCenter].to_s)
|
124
|
+
end
|
125
|
+
if hProjection[:latitudeOfProjectionCenter].nil?
|
126
|
+
@hResponseObj[:writerPass] = false
|
127
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing latitude of projection center'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# map projection (sfequat) - scale factor at equator (required)
|
132
|
+
def write_scaleFactorE(hProjection)
|
133
|
+
unless hProjection[:scaleFactorAtEquator].nil?
|
134
|
+
@xml.tag!('sfequat', hProjection[:scaleFactorAtEquator].to_s)
|
135
|
+
end
|
136
|
+
if hProjection[:scaleFactorAtEquator].nil?
|
137
|
+
@hResponseObj[:writerPass] = false
|
138
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing scale factor at equator'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# map projection (sfctrlin) - scale factor at center line (required)
|
143
|
+
def write_scaleFactorCL(hProjection)
|
144
|
+
unless hProjection[:scaleFactorAtCenterLine].nil?
|
145
|
+
@xml.tag!('sfctrlin', hProjection[:scaleFactorAtCenterLine].to_s)
|
146
|
+
end
|
147
|
+
if hProjection[:scaleFactorAtCenterLine].nil?
|
148
|
+
@hResponseObj[:writerPass] = false
|
149
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing scale factor at center line'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# map projection (sfprjorg) - scale factor at projection origin (required)
|
154
|
+
def write_scaleFactorPO(hProjection)
|
155
|
+
unless hProjection[:scaleFactorAtProjectionOrigin].nil?
|
156
|
+
@xml.tag!('sfprjorg', hProjection[:scaleFactorAtProjectionOrigin].to_s)
|
157
|
+
end
|
158
|
+
if hProjection[:scaleFactorAtProjectionOrigin].nil?
|
159
|
+
@hResponseObj[:writerPass] = false
|
160
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing scale factor at projection origin'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# map projection (sfctrmer) - scale factor at central meridian (required)
|
165
|
+
def write_scaleFactorCM(hProjection)
|
166
|
+
unless hProjection[:scaleFactorAtCentralMeridian].nil?
|
167
|
+
@xml.tag!('sfctrmer', hProjection[:scaleFactorAtCentralMeridian].to_s)
|
168
|
+
end
|
169
|
+
if hProjection[:scaleFactorAtCentralMeridian].nil?
|
170
|
+
@hResponseObj[:writerPass] = false
|
171
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing scale factor at central meridian'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# map projection (obqlazim) - oblique line azimuth (required)
|
176
|
+
def write_obliqueLineAzimuth(hProjection)
|
177
|
+
haveLA = true
|
178
|
+
haveLA = false if hProjection[:azimuthAngle].nil?
|
179
|
+
haveLA = false if hProjection[:azimuthMeasurePointLongitude].nil?
|
180
|
+
if haveLA
|
181
|
+
@xml.tag!('obqlazim') do
|
182
|
+
unless hProjection[:azimuthAngle].nil?
|
183
|
+
@xml.tag!('azimangl', hProjection[:azimuthAngle].to_s)
|
184
|
+
end
|
185
|
+
if hProjection[:azimuthAngle].nil?
|
186
|
+
@hResponseObj[:writerPass] = false
|
187
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing oblique line azimuth angle'
|
188
|
+
end
|
189
|
+
unless hProjection[:azimuthMeasurePointLongitude].nil?
|
190
|
+
@xml.tag!('azimptl', hProjection[:azimuthMeasurePointLongitude].to_s)
|
191
|
+
end
|
192
|
+
if hProjection[:azimuthMeasurePointLongitude].nil?
|
193
|
+
@hResponseObj[:writerPass] = false
|
194
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing oblique line measure point longitude'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
unless haveLA
|
199
|
+
@hResponseObj[:writerPass] = false
|
200
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing oblique line azimuth information'
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# map projection (obqlpt) - oblique line point (required)
|
205
|
+
def write_obliqueLinePoint(hLinePt)
|
206
|
+
unless hLinePt[:azimuthLineLatitude].nil?
|
207
|
+
@xml.tag!('obqllat', hLinePt[:azimuthLineLatitude])
|
208
|
+
end
|
209
|
+
if hLinePt[:azimuthLineLatitude].nil?
|
210
|
+
@hResponseObj[:writerPass] = false
|
211
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing oblique line point latitude'
|
212
|
+
end
|
213
|
+
unless hLinePt[:azimuthLineLongitude].nil?
|
214
|
+
@xml.tag!('obqllong', hLinePt[:azimuthLineLongitude])
|
215
|
+
end
|
216
|
+
if hLinePt[:azimuthLineLongitude].nil?
|
217
|
+
@hResponseObj[:writerPass] = false
|
218
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing oblique line point longitude'
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# map projection (svlong) - straight vertical longitude from pole (required)
|
223
|
+
def write_straightFromPole(hProjection)
|
224
|
+
unless hProjection[:straightVerticalLongitudeFromPole].nil?
|
225
|
+
@xml.tag!('svlong', hProjection[:straightVerticalLongitudeFromPole].to_s)
|
226
|
+
end
|
227
|
+
if hProjection[:straightVerticalLongitudeFromPole].nil?
|
228
|
+
@hResponseObj[:writerPass] = false
|
229
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing straight vertical longitude from pole'
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# map projection (landsat) - landsat number (required)
|
234
|
+
def write_landsat(hProjection)
|
235
|
+
unless hProjection[:landsatNumber].nil?
|
236
|
+
@xml.tag!('landsat', hProjection[:landsatNumber].to_s)
|
237
|
+
end
|
238
|
+
if hProjection[:landsatNumber].nil?
|
239
|
+
@hResponseObj[:writerPass] = false
|
240
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing Landsat number'
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# map projection (pathnum) - landsat path (required)
|
245
|
+
def write_landsatPath(hProjection)
|
246
|
+
unless hProjection[:landsatPath].nil?
|
247
|
+
@xml.tag!('pathnum', hProjection[:landsatPath].to_s)
|
248
|
+
end
|
249
|
+
if hProjection[:landsatPath].nil?
|
250
|
+
@hResponseObj[:writerPass] = false
|
251
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing Landsat path number'
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
# map projection (otherprj) - other projection description (required)
|
256
|
+
def write_otherProjection(hProjection)
|
257
|
+
unless hProjection[:otherProjectionDescription].nil?
|
258
|
+
@xml.tag!('otherprj', hProjection[:otherProjectionDescription])
|
259
|
+
end
|
260
|
+
if hProjection[:otherProjectionDescription].nil?
|
261
|
+
@hResponseObj[:writerPass] = false
|
262
|
+
@hResponseObj[:writerMessages] << 'Map Projection is missing other projection description'
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# map projection (mapprojp) - other projection description (required)
|
267
|
+
def write_allParams(hProjection)
|
268
|
+
# save current writer error state
|
269
|
+
writerPass = @hResponseObj[:writerPass]
|
270
|
+
writerMessages = @hResponseObj[:writerMessages]
|
271
|
+
|
272
|
+
# write all parameters
|
273
|
+
write_falseNE(hProjection)
|
274
|
+
write_standParallel(hProjection)
|
275
|
+
write_longCM(hProjection)
|
276
|
+
write_latPO(hProjection)
|
277
|
+
write_heightPP(hProjection)
|
278
|
+
write_longPC(hProjection)
|
279
|
+
write_latPC(hProjection)
|
280
|
+
write_scaleFactorE(hProjection)
|
281
|
+
write_scaleFactorCL(hProjection)
|
282
|
+
write_scaleFactorPO(hProjection)
|
283
|
+
write_scaleFactorCM(hProjection)
|
284
|
+
write_obliqueLineAzimuth(hProjection)
|
285
|
+
unless hProjection[:obliqueLinePoints].empty?
|
286
|
+
@xml.tag!('obqlpt') do
|
287
|
+
hProjection[:obliqueLinePoints].each do |hLinePt|
|
288
|
+
write_obliqueLinePoint(hLinePt)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
write_straightFromPole(hProjection)
|
293
|
+
write_landsat(hProjection)
|
294
|
+
write_landsatPath(hProjection)
|
295
|
+
write_otherProjection(hProjection)
|
296
|
+
|
297
|
+
# restore writer error state
|
298
|
+
@hResponseObj[:writerPass] = writerPass
|
299
|
+
@hResponseObj[:writerMessages] = writerMessages
|
300
|
+
|
301
|
+
end
|
302
|
+
|
303
|
+
# grid coordinate system (utmzone) - universal transverse mercator zone (required)
|
304
|
+
def write_utmZone(hProjection)
|
305
|
+
unless hProjection[:gridZone].nil?
|
306
|
+
@xml.tag!('utmzone', hProjection[:gridZone])
|
307
|
+
end
|
308
|
+
if hProjection[:gridZone].nil?
|
309
|
+
@hResponseObj[:writerPass] = false
|
310
|
+
@hResponseObj[:writerMessages] << 'UTM Projection is missing zone number'
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
# grid coordinate system (upszone) - universal polar stereographic zone (required)
|
315
|
+
def write_upsZone(hProjection)
|
316
|
+
unless hProjection[:gridZone].nil?
|
317
|
+
@xml.tag!('upszone', hProjection[:gridZone])
|
318
|
+
end
|
319
|
+
if hProjection[:gridZone].nil?
|
320
|
+
@hResponseObj[:writerPass] = false
|
321
|
+
@hResponseObj[:writerMessages] << 'UPS Projection is missing zone number'
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
# grid coordinate system (spcszone) - state plane coordinate system zone (required)
|
326
|
+
def write_spcsZone(hProjection)
|
327
|
+
unless hProjection[:gridZone].nil?
|
328
|
+
@xml.tag!('spcszone', hProjection[:gridZone])
|
329
|
+
end
|
330
|
+
if hProjection[:gridZone].nil?
|
331
|
+
@hResponseObj[:writerPass] = false
|
332
|
+
@hResponseObj[:writerMessages] << 'State Plane Coordinate System is missing zone number'
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
# grid coordinate system (arczone) - equal arc-second coordinate system zone (required)
|
337
|
+
def write_arcZone(hProjection)
|
338
|
+
unless hProjection[:gridZone].nil?
|
339
|
+
@xml.tag!('arczone', hProjection[:gridZone])
|
340
|
+
end
|
341
|
+
if hProjection[:gridZone].nil?
|
342
|
+
@hResponseObj[:writerPass] = false
|
343
|
+
@hResponseObj[:writerMessages] << 'Equal arc-second Coordinate System is missing zone number'
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
# grid coordinate system (localpd) - local planar description (required)
|
348
|
+
def write_localDesc(hProjection)
|
349
|
+
unless hProjection[:localPlanarDescription].nil?
|
350
|
+
@xml.tag!('localpd', hProjection[:localPlanarDescription])
|
351
|
+
end
|
352
|
+
if hProjection[:localPlanarDescription].nil?
|
353
|
+
@hResponseObj[:writerPass] = false
|
354
|
+
@hResponseObj[:writerMessages] << 'Local Planar Coordinate System is missing description'
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# grid coordinate system (localpgi) - local planar georeference information (required)
|
359
|
+
def write_localGeoInfo(hProjection)
|
360
|
+
unless hProjection[:localPlanarGeoreference].nil?
|
361
|
+
@xml.tag!('localpgi', hProjection[:localPlanarGeoreference])
|
362
|
+
end
|
363
|
+
if hProjection[:localPlanarGeoreference].nil?
|
364
|
+
@hResponseObj[:writerPass] = false
|
365
|
+
@hResponseObj[:writerMessages] << 'Local Planar Coordinate System is missing georeference information'
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
end # MapProjection
|
370
|
+
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
@@ -0,0 +1,372 @@
|
|
1
|
+
# FGDC <<Class>> PlanarReference
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-01-02 original script
|
6
|
+
|
7
|
+
require_relative 'class_mapProjection'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Fgdc
|
13
|
+
|
14
|
+
class PlanarReference
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
end
|
20
|
+
|
21
|
+
def writeXML(hProjection)
|
22
|
+
|
23
|
+
# classes used
|
24
|
+
classProjection = MapProjection.new(@xml, @hResponseObj)
|
25
|
+
|
26
|
+
# planar 4.1.2.1 (mapproj) - map projection
|
27
|
+
# <- hProjection.projectionName = oneOf ...
|
28
|
+
projection = hProjection[:projection]
|
29
|
+
case projection
|
30
|
+
when 'alaska'
|
31
|
+
@xml.tag!('mapproj') do
|
32
|
+
classProjection.write_name('Modified Stereographic for Alaska')
|
33
|
+
@xml.tag!('modsak') do
|
34
|
+
classProjection.write_falseNE(hProjection)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
when 'albers'
|
38
|
+
@xml.tag!('mapproj') do
|
39
|
+
classProjection.write_name('Albers Conical Equal Area')
|
40
|
+
@xml.tag!('albers') do
|
41
|
+
classProjection.write_standParallel(hProjection)
|
42
|
+
classProjection.write_longCM(hProjection)
|
43
|
+
classProjection.write_latPO(hProjection)
|
44
|
+
classProjection.write_falseNE(hProjection)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
when 'azimuthalEquidistant'
|
48
|
+
@xml.tag!('mapproj') do
|
49
|
+
classProjection.write_name('Azimuthal Equidistant')
|
50
|
+
@xml.tag!('azimequi') do
|
51
|
+
classProjection.write_longCM(hProjection)
|
52
|
+
classProjection.write_latPO(hProjection)
|
53
|
+
classProjection.write_falseNE(hProjection)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
when 'equidistantConic'
|
57
|
+
@xml.tag!('mapproj') do
|
58
|
+
classProjection.write_name('Equidistant Conic')
|
59
|
+
@xml.tag!('equicon') do
|
60
|
+
classProjection.write_standParallel(hProjection)
|
61
|
+
classProjection.write_longCM(hProjection)
|
62
|
+
classProjection.write_latPO(hProjection)
|
63
|
+
classProjection.write_falseNE(hProjection)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
when 'equirectangular'
|
67
|
+
@xml.tag!('mapproj') do
|
68
|
+
classProjection.write_name('Equirectangular')
|
69
|
+
@xml.tag!('equirect') do
|
70
|
+
classProjection.write_standParallel(hProjection)
|
71
|
+
classProjection.write_longCM(hProjection)
|
72
|
+
classProjection.write_falseNE(hProjection)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
when 'generalVertical'
|
76
|
+
@xml.tag!('mapproj') do
|
77
|
+
classProjection.write_name('General Vertical Near-sided Perspective')
|
78
|
+
@xml.tag!('gvnsp') do
|
79
|
+
classProjection.write_heightPP(hProjection)
|
80
|
+
classProjection.write_longPC(hProjection)
|
81
|
+
classProjection.write_latPC(hProjection)
|
82
|
+
classProjection.write_falseNE(hProjection)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
when 'gnomonic'
|
86
|
+
@xml.tag!('mapproj') do
|
87
|
+
classProjection.write_name('Gnomonic')
|
88
|
+
@xml.tag!('gnomonic') do
|
89
|
+
classProjection.write_longPC(hProjection)
|
90
|
+
classProjection.write_latPC(hProjection)
|
91
|
+
classProjection.write_falseNE(hProjection)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
when 'lambertEqualArea'
|
95
|
+
@xml.tag!('mapproj') do
|
96
|
+
classProjection.write_name('Lambert Azimuthal Equal Area')
|
97
|
+
@xml.tag!('lamberta') do
|
98
|
+
classProjection.write_longPC(hProjection)
|
99
|
+
classProjection.write_latPC(hProjection)
|
100
|
+
classProjection.write_falseNE(hProjection)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
when 'lambertConic'
|
104
|
+
@xml.tag!('mapproj') do
|
105
|
+
classProjection.write_name('Lambert Conformal Conic')
|
106
|
+
@xml.tag!('lambertc') do
|
107
|
+
classProjection.write_standParallel(hProjection)
|
108
|
+
classProjection.write_longCM(hProjection)
|
109
|
+
classProjection.write_latPO(hProjection)
|
110
|
+
classProjection.write_falseNE(hProjection)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
when 'mercator'
|
114
|
+
@xml.tag!('mapproj') do
|
115
|
+
classProjection.write_name('Mercator')
|
116
|
+
@xml.tag!('mercator') do
|
117
|
+
if hProjection[:standardParallel1] || hProjection[:standardParallel2]
|
118
|
+
classProjection.write_standParallel(hProjection)
|
119
|
+
elsif hProjection[:scaleFactorAtEquator]
|
120
|
+
classProjection.write_scaleFactorE(hProjection)
|
121
|
+
end
|
122
|
+
classProjection.write_longCM(hProjection)
|
123
|
+
classProjection.write_falseNE(hProjection)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
when 'miller'
|
127
|
+
@xml.tag!('mapproj') do
|
128
|
+
classProjection.write_name('Miller Cylindrical')
|
129
|
+
@xml.tag!('miller') do
|
130
|
+
classProjection.write_longCM(hProjection)
|
131
|
+
classProjection.write_falseNE(hProjection)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
when 'obliqueMercator'
|
135
|
+
@xml.tag!('mapproj') do
|
136
|
+
classProjection.write_name('Oblique Mercator')
|
137
|
+
@xml.tag!('obqmerc') do
|
138
|
+
classProjection.write_scaleFactorCL(hProjection)
|
139
|
+
if hProjection[:obliqueLinePoints].empty?
|
140
|
+
classProjection.write_obliqueLineAzimuth(hProjection)
|
141
|
+
else
|
142
|
+
@xml.tag!('obqlpt') do
|
143
|
+
hProjection[:obliqueLinePoints].each do |hLinePt|
|
144
|
+
classProjection.write_obliqueLinePoint(hLinePt)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
classProjection.write_latPO(hProjection)
|
149
|
+
classProjection.write_falseNE(hProjection)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
when 'orthographic'
|
153
|
+
@xml.tag!('mapproj') do
|
154
|
+
classProjection.write_name('Orthographic')
|
155
|
+
@xml.tag!('orthogr') do
|
156
|
+
classProjection.write_longPC(hProjection)
|
157
|
+
classProjection.write_latPC(hProjection)
|
158
|
+
classProjection.write_falseNE(hProjection)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
when 'polarStereo'
|
162
|
+
@xml.tag!('mapproj') do
|
163
|
+
classProjection.write_name('Polar Stereographic')
|
164
|
+
@xml.tag!('polarst') do
|
165
|
+
classProjection.write_straightFromPole(hProjection)
|
166
|
+
if hProjection[:standardParallel1] || hProjection[:standardParallel2]
|
167
|
+
classProjection.write_standParallel(hProjection)
|
168
|
+
elsif hProjection[:scaleFactorAtProjectionOrigin]
|
169
|
+
classProjection.write_scaleFactorPO(hProjection)
|
170
|
+
end
|
171
|
+
classProjection.write_falseNE(hProjection)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
when 'polyconic'
|
175
|
+
@xml.tag!('mapproj') do
|
176
|
+
classProjection.write_name('Polyconic')
|
177
|
+
@xml.tag!('polycon') do
|
178
|
+
classProjection.write_longCM(hProjection)
|
179
|
+
classProjection.write_latPO(hProjection)
|
180
|
+
classProjection.write_falseNE(hProjection)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
when 'robinson'
|
184
|
+
@xml.tag!('mapproj') do
|
185
|
+
classProjection.write_name('Robinson')
|
186
|
+
@xml.tag!('robinson') do
|
187
|
+
classProjection.write_longPC(hProjection)
|
188
|
+
classProjection.write_falseNE(hProjection)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
when 'sinusoidal'
|
192
|
+
@xml.tag!('mapproj') do
|
193
|
+
classProjection.write_name('Sinusoidal')
|
194
|
+
@xml.tag!('sinusoid') do
|
195
|
+
classProjection.write_longCM(hProjection)
|
196
|
+
classProjection.write_falseNE(hProjection)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
when 'spaceOblique'
|
200
|
+
@xml.tag!('mapproj') do
|
201
|
+
classProjection.write_name('Space Oblique Mercator')
|
202
|
+
@xml.tag!('spaceobq') do
|
203
|
+
classProjection.write_landsat(hProjection)
|
204
|
+
classProjection.write_landsatPath(hProjection)
|
205
|
+
classProjection.write_falseNE(hProjection)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
when 'stereographic'
|
209
|
+
@xml.tag!('mapproj') do
|
210
|
+
classProjection.write_name('Stereographic')
|
211
|
+
@xml.tag!('stereo') do
|
212
|
+
classProjection.write_longPC(hProjection)
|
213
|
+
classProjection.write_latPC(hProjection)
|
214
|
+
classProjection.write_falseNE(hProjection)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
when 'transverseMercator'
|
218
|
+
@xml.tag!('mapproj') do
|
219
|
+
classProjection.write_name('Transverse Mercator')
|
220
|
+
@xml.tag!('transmer') do
|
221
|
+
classProjection.write_scaleFactorCM(hProjection)
|
222
|
+
classProjection.write_longCM(hProjection)
|
223
|
+
classProjection.write_latPO(hProjection)
|
224
|
+
classProjection.write_falseNE(hProjection)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
when 'grinten'
|
228
|
+
@xml.tag!('mapproj') do
|
229
|
+
classProjection.write_name('van der Grinten')
|
230
|
+
@xml.tag!('vdgrin') do
|
231
|
+
classProjection.write_longCM(hProjection)
|
232
|
+
classProjection.write_falseNE(hProjection)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
when 'parameters'
|
236
|
+
@xml.tag!('mapproj') do
|
237
|
+
classProjection.write_name('Map Projection Parameters')
|
238
|
+
@xml.tag!('mapprojp') do
|
239
|
+
classProjection.write_allParams(hProjection)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# planar 4.1.2.2 (gridsys) - grid coordinate system
|
245
|
+
# <- hProjection.projectionName = oneOf ...
|
246
|
+
gridSystem = hProjection[:gridSystem]
|
247
|
+
case gridSystem
|
248
|
+
when 'utm'
|
249
|
+
@xml.tag!('gridsys') do
|
250
|
+
if hProjection[:gridSystemName].nil?
|
251
|
+
classProjection.write_gridName('Universal Transverse Mercator (UTM)')
|
252
|
+
else
|
253
|
+
classProjection.write_gridName(hProjection[:gridSystemName])
|
254
|
+
end
|
255
|
+
@xml.tag!('utm') do
|
256
|
+
classProjection.write_utmZone(hProjection)
|
257
|
+
@xml.tag!('transmer') do
|
258
|
+
classProjection.write_scaleFactorCM(hProjection)
|
259
|
+
classProjection.write_longCM(hProjection)
|
260
|
+
classProjection.write_latPO(hProjection)
|
261
|
+
classProjection.write_falseNE(hProjection)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
when 'ups'
|
266
|
+
@xml.tag!('gridsys') do
|
267
|
+
if hProjection[:gridSystemName].nil?
|
268
|
+
classProjection.write_gridName('Universal Polar Stereographic (UPS)')
|
269
|
+
else
|
270
|
+
classProjection.write_gridName(hProjection[:gridSystemName])
|
271
|
+
end
|
272
|
+
@xml.tag!('ups') do
|
273
|
+
classProjection.write_upsZone(hProjection)
|
274
|
+
@xml.tag!('polarst') do
|
275
|
+
classProjection.write_straightFromPole(hProjection)
|
276
|
+
if hProjection[:standardParallel1] || hProjection[:standardParallel2]
|
277
|
+
classProjection.write_standParallel(hProjection)
|
278
|
+
elsif hProjection[:scaleFactorAtProjectionOrigin]
|
279
|
+
classProjection.write_scaleFactorPO(hProjection)
|
280
|
+
end
|
281
|
+
classProjection.write_falseNE(hProjection)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
when 'spcs'
|
286
|
+
@xml.tag!('gridsys') do
|
287
|
+
if hProjection[:gridSystemName].nil?
|
288
|
+
classProjection.write_gridName('State Plane Coordinate System')
|
289
|
+
else
|
290
|
+
classProjection.write_gridName(hProjection[:gridSystemName])
|
291
|
+
end
|
292
|
+
@xml.tag!('spcs') do
|
293
|
+
classProjection.write_spcsZone(hProjection)
|
294
|
+
if hProjection[:standardParallel1] || hProjection[:standardParallel2]
|
295
|
+
@xml.tag!('lambertc') do
|
296
|
+
classProjection.write_standParallel(hProjection)
|
297
|
+
classProjection.write_longCM(hProjection)
|
298
|
+
classProjection.write_latPO(hProjection)
|
299
|
+
classProjection.write_falseNE(hProjection)
|
300
|
+
end
|
301
|
+
elsif hProjection[:scaleFactorAtCenterLine]
|
302
|
+
@xml.tag!('obqmerc') do
|
303
|
+
classProjection.write_scaleFactorCL(hProjection)
|
304
|
+
if hProjection[:obliqueLinePoints].empty?
|
305
|
+
classProjection.write_obliqueLineAzimuth(hProjection)
|
306
|
+
else
|
307
|
+
@xml.tag!('obqlpt') do
|
308
|
+
hProjection[:obliqueLinePoints].each do |hLinePt|
|
309
|
+
classProjection.write_obliqueLinePoint(hLinePt)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
classProjection.write_latPO(hProjection)
|
314
|
+
classProjection.write_falseNE(hProjection)
|
315
|
+
end
|
316
|
+
elsif hProjection[:scaleFactorAtCentralMeridian]
|
317
|
+
@xml.tag!('transmer') do
|
318
|
+
classProjection.write_scaleFactorCM(hProjection)
|
319
|
+
classProjection.write_longCM(hProjection)
|
320
|
+
classProjection.write_latPO(hProjection)
|
321
|
+
classProjection.write_falseNE(hProjection)
|
322
|
+
end
|
323
|
+
else
|
324
|
+
@xml.tag!('polycon') do
|
325
|
+
classProjection.write_longCM(hProjection)
|
326
|
+
classProjection.write_latPO(hProjection)
|
327
|
+
classProjection.write_falseNE(hProjection)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
when 'arcsys'
|
333
|
+
@xml.tag!('gridsys') do
|
334
|
+
if hProjection[:gridSystemName].nil?
|
335
|
+
classProjection.write_gridName('Equal Arc-second Coordinate System')
|
336
|
+
else
|
337
|
+
classProjection.write_gridName(hProjection[:gridSystemName])
|
338
|
+
end
|
339
|
+
@xml.tag!('arcsys') do
|
340
|
+
classProjection.write_arcZone(hProjection)
|
341
|
+
if hProjection[:standardParallel1] || hProjection[:standardParallel2]
|
342
|
+
@xml.tag!('equirect') do
|
343
|
+
classProjection.write_standParallel(hProjection)
|
344
|
+
classProjection.write_longCM(hProjection)
|
345
|
+
classProjection.write_falseNE(hProjection)
|
346
|
+
end
|
347
|
+
elsif hProjection[:latitudeOfProjectionOrigin]
|
348
|
+
@xml.tag!('azimequi') do
|
349
|
+
classProjection.write_longCM(hProjection)
|
350
|
+
classProjection.write_latPO(hProjection)
|
351
|
+
classProjection.write_falseNE(hProjection)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# planar 4.1.2.3 (localp) - local planar
|
359
|
+
if projection == 'localPlanar'
|
360
|
+
@xml.tag!('localp') do
|
361
|
+
classProjection.write_localDesc(hProjection)
|
362
|
+
classProjection.write_localGeoInfo(hProjection)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
end # writeXML
|
367
|
+
end # PlanarReference
|
368
|
+
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|