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
@@ -36,7 +36,7 @@ module ADIWG
|
|
36
36
|
if hTag['scheme'].downcase == 'none'
|
37
37
|
hTag['scheme'] = 'none'
|
38
38
|
end
|
39
|
-
if hTag['scheme'] == 'ISO 19115 Topic
|
39
|
+
if hTag['scheme'] == 'ISO 19115 Topic Category'
|
40
40
|
hTag['scheme'] = 'none'
|
41
41
|
hTag['type'] = 'isoTopicCategory'
|
42
42
|
end
|
@@ -52,7 +52,7 @@ module ADIWG
|
|
52
52
|
if hTag['type'].downcase == 'none'
|
53
53
|
hTag['type'] = 'none'
|
54
54
|
end
|
55
|
-
if hTag['type'] == 'ISO 19115 Topic
|
55
|
+
if hTag['type'] == 'ISO 19115 Topic Category'
|
56
56
|
hTag['scheme'] = 'none'
|
57
57
|
hTag['type'] = 'isoTopicCategory'
|
58
58
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# adiwg mdTranslator
|
2
2
|
|
3
3
|
# version 2 history
|
4
|
+
# 2.8.0 2018-01-17 added fgdc writer spatial reference section
|
5
|
+
# 2.7.1 2018-01-05 fix issue #171, fully implement deprecation of topicCategories[]
|
6
|
+
# 2.7.0 2017-12-28 reinstate schema validation checks for schema 2.4.1
|
4
7
|
# 2.7.0 2017-12-26 add fgdc writer identification info section
|
5
8
|
# 2.7.0 2017-12-26 add fgdc writer data quality info section
|
6
9
|
# 2.7.0 2017-12-26 add fgdc writer spatial domain info section
|
@@ -55,7 +58,7 @@
|
|
55
58
|
module ADIWG
|
56
59
|
module Mdtranslator
|
57
60
|
# current mdtranslator version
|
58
|
-
VERSION = "2.
|
61
|
+
VERSION = "2.8.0"
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
@@ -61,6 +61,7 @@ module ADIWG
|
|
61
61
|
if hDate[:dateType] == 'publication'
|
62
62
|
pubDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:date], hDate[:dateResolution])
|
63
63
|
pubTime = AdiwgDateTimeFun.stringTimeFromDateTime(hDate[:date], hDate[:dateResolution])
|
64
|
+
pubDate.gsub!(/[-]/,'')
|
64
65
|
unless pubDate == 'ERROR'
|
65
66
|
@xml.tag!('pubdate', pubDate)
|
66
67
|
havePubDate = true
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# FGDC CSDGM writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2018-01-19 convert ISO date formats to FGDC
|
6
|
+
# Stan Smith 2017-11-23 original script
|
6
7
|
|
7
8
|
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
9
|
|
@@ -25,6 +26,10 @@ module ADIWG
|
|
25
26
|
sEDate = AdiwgDateTimeFun.stringDateFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
26
27
|
sETime = AdiwgDateTimeFun.stringTimeFromDateTime(hEndDT[:dateTime], hEndDT[:dateResolution])
|
27
28
|
|
29
|
+
# convert ISO date format to FGDC
|
30
|
+
sSDate.gsub!(/[-]/,'')
|
31
|
+
sEDate.gsub!(/[-]/,'')
|
32
|
+
|
28
33
|
# single date 9.3 (rngdates) - date range
|
29
34
|
@xml.tag!('rngdates') do
|
30
35
|
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# FGDC CSDGM writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2018-01-19 convert ISO date formats to FGDC
|
6
|
+
# Stan Smith 2017-11-23 original script
|
6
7
|
|
7
8
|
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
8
9
|
|
@@ -23,6 +24,9 @@ module ADIWG
|
|
23
24
|
sDate = AdiwgDateTimeFun.stringDateFromDateTime(hDate[:dateTime], hDate[:dateResolution])
|
24
25
|
sTime = AdiwgDateTimeFun.stringTimeFromDateTime(hDate[:dateTime], hDate[:dateResolution])
|
25
26
|
|
27
|
+
# convert ISO date format to FGDC
|
28
|
+
sDate.gsub!(/[-]/,'')
|
29
|
+
|
26
30
|
# single date 9.1 (sngdate) - single date (required)
|
27
31
|
@xml.tag!('sngdate') do
|
28
32
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
require_relative 'class_identification'
|
8
8
|
require_relative 'class_quality'
|
9
9
|
require_relative 'class_spatialOrganization'
|
10
|
+
require_relative 'class_spatialReference'
|
10
11
|
|
11
12
|
module ADIWG
|
12
13
|
module Mdtranslator
|
@@ -29,6 +30,7 @@ module ADIWG
|
|
29
30
|
idClass = Identification.new(@xml, @hResponseObj)
|
30
31
|
qualityClass = Quality.new(@xml, @hResponseObj)
|
31
32
|
spaceOrgClass = SpatialOrganization.new(@xml, @hResponseObj)
|
33
|
+
spaceRefClass = SpatialReference.new(@xml, @hResponseObj)
|
32
34
|
|
33
35
|
# document head
|
34
36
|
metadata = @xml.instruct! :xml, encoding: 'UTF-8'
|
@@ -60,17 +62,17 @@ module ADIWG
|
|
60
62
|
end
|
61
63
|
|
62
64
|
# metadata 3 (spdoinfo) - spatial domain information
|
63
|
-
|
64
|
-
|
65
|
-
|
65
|
+
haveDomain = false
|
66
|
+
haveDomain = true unless hResourceInfo[:spatialRepresentations].empty?
|
67
|
+
haveDomain = true unless hResourceInfo[:spatialRepresentationTypes].empty?
|
66
68
|
hResourceInfo[:spatialReferenceSystems].each do |hSystem|
|
67
69
|
unless hSystem[:systemIdentifier].empty?
|
68
70
|
if hSystem[:systemIdentifier][:identifier] == 'indirect'
|
69
|
-
|
71
|
+
haveDomain = true
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
73
|
-
if
|
75
|
+
if haveDomain
|
74
76
|
@xml.tag!('spdoinfo') do
|
75
77
|
spaceOrgClass.writeXML(hResourceInfo)
|
76
78
|
end
|
@@ -79,6 +81,17 @@ module ADIWG
|
|
79
81
|
end
|
80
82
|
|
81
83
|
# metadata 4 (spref) - spatial reference systems
|
84
|
+
haveSpaceRef = false
|
85
|
+
haveSpaceRef = true unless hResourceInfo[:spatialResolutions].empty?
|
86
|
+
haveSpaceRef = true unless hResourceInfo[:spatialReferenceSystems].empty?
|
87
|
+
if haveSpaceRef
|
88
|
+
@xml.tag!('spref') do
|
89
|
+
spaceRefClass.writeXML(hResourceInfo)
|
90
|
+
end
|
91
|
+
elsif @hResponseObj[:writerShowTags]
|
92
|
+
@xml.tag!('spref')
|
93
|
+
end
|
94
|
+
|
82
95
|
# metadata 5 (eainfo) - entity attribute information
|
83
96
|
# metadata 6 (distinfo) - distribution information
|
84
97
|
# metadata 7 (metainfo) - metadata information
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# FGDC <<Class>> SpatialReference
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-01-15 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class GeodeticReference
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(hGeodetic)
|
20
|
+
|
21
|
+
# geodetic reference system 4.1.4.1 (horizdn) - horizontal datum name
|
22
|
+
unless hGeodetic[:datumName].nil?
|
23
|
+
@xml.tag!('horizdn', hGeodetic[:datumName])
|
24
|
+
end
|
25
|
+
if hGeodetic[:datumName].nil? && @hResponseObj[:writerShowTags]
|
26
|
+
@xml.tag!('horizdn')
|
27
|
+
end
|
28
|
+
|
29
|
+
# geodetic reference system 4.1.4.2 (ellips) - ellipsoid name (required)
|
30
|
+
unless hGeodetic[:ellipsoidName].nil?
|
31
|
+
@xml.tag!('ellips', hGeodetic[:ellipsoidName])
|
32
|
+
end
|
33
|
+
if hGeodetic[:ellipsoidName].nil?
|
34
|
+
@hResponseObj[:writerPass] = false
|
35
|
+
@hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing ellipsoid name'
|
36
|
+
end
|
37
|
+
|
38
|
+
# geodetic reference system 4.1.4.3 (semiaxis) - ellipsoid semi-major axis (required)
|
39
|
+
unless hGeodetic[:semiMajorAxis].nil?
|
40
|
+
@xml.tag!('semiaxis', hGeodetic[:semiMajorAxis])
|
41
|
+
end
|
42
|
+
if hGeodetic[:semiMajorAxis].nil?
|
43
|
+
@hResponseObj[:writerPass] = false
|
44
|
+
@hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing semi-major axis'
|
45
|
+
end
|
46
|
+
|
47
|
+
# geodetic reference system 4.1.4.4 (denflat) - ellipsoid denominator of flattening ratio (required)
|
48
|
+
unless hGeodetic[:denominatorOfFlatteningRatio].nil?
|
49
|
+
@xml.tag!('denflat', hGeodetic[:denominatorOfFlatteningRatio])
|
50
|
+
end
|
51
|
+
if hGeodetic[:denominatorOfFlatteningRatio].nil?
|
52
|
+
@hResponseObj[:writerPass] = false
|
53
|
+
@hResponseObj[:writerMessages] << 'Geodetic Coordinate System is missing denominator of flattening ratio'
|
54
|
+
end
|
55
|
+
|
56
|
+
end # writeXML
|
57
|
+
end # GeodeticReference
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# FGDC <<Class>> GeographicResolution
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-12-29 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class GeographicResolution
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(hGeoRes)
|
20
|
+
|
21
|
+
# horizontal reference 4.1.1 (geograph) - geographic resolution
|
22
|
+
|
23
|
+
# geographic resolution 4.1.1.1 (latres) - latitude resolution (required)
|
24
|
+
unless hGeoRes[:latitudeResolution].nil?
|
25
|
+
@xml.tag!('latres', hGeoRes[:latitudeResolution]).to_s
|
26
|
+
end
|
27
|
+
if hGeoRes[:latitudeResolution].nil?
|
28
|
+
@hResponseObj[:writerPass] = false
|
29
|
+
@hResponseObj[:writerMessages] << 'Geographic Resolution is missing latitude resolution'
|
30
|
+
end
|
31
|
+
|
32
|
+
# geographic resolution 4.1.1.2 (longres) - longitude resolution (required)
|
33
|
+
unless hGeoRes[:longitudeResolution].nil?
|
34
|
+
@xml.tag!('longres', hGeoRes[:longitudeResolution]).to_s
|
35
|
+
end
|
36
|
+
if hGeoRes[:longitudeResolution].nil?
|
37
|
+
@hResponseObj[:writerPass] = false
|
38
|
+
@hResponseObj[:writerMessages] << 'Geographic Resolution is missing longitude resolution'
|
39
|
+
end
|
40
|
+
|
41
|
+
# geographic resolution 4.1.1.3 (geogunit) - longitude resolution (required)
|
42
|
+
unless hGeoRes[:unitOfMeasure].nil?
|
43
|
+
@xml.tag!('geogunit', hGeoRes[:unitOfMeasure])
|
44
|
+
end
|
45
|
+
if hGeoRes[:unitOfMeasure].nil?
|
46
|
+
@hResponseObj[:writerPass] = false
|
47
|
+
@hResponseObj[:writerMessages] << 'Geographic Resolution is missing unit of measure'
|
48
|
+
end
|
49
|
+
|
50
|
+
end # writeXML
|
51
|
+
end # GeographicResolution
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -37,6 +37,7 @@ module ADIWG
|
|
37
37
|
# keyword 1.6.1 (theme) - theme keywords
|
38
38
|
if type == 'theme' || type == 'isoTopicCategory'
|
39
39
|
@xml.tag!('theme') do
|
40
|
+
thesaurusName = 'ISO 19115 Topic Category' if type == 'isoTopicCategory'
|
40
41
|
@xml.tag!('themekt', thesaurusName)
|
41
42
|
aKeywords.each do |hKeyword|
|
42
43
|
keyword = hKeyword[:keyword]
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# FGDC <<Class>> SpatialReference
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-01-15 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class LocalSystem
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(hProjection)
|
20
|
+
|
21
|
+
# local system (local) - local coordinate system description (required)
|
22
|
+
unless hProjection[:localPlanarDescription].nil?
|
23
|
+
@xml.tag!('localdes', hProjection[:localPlanarDescription])
|
24
|
+
end
|
25
|
+
if hProjection[:localPlanarDescription].nil?
|
26
|
+
@hResponseObj[:writerPass] = false
|
27
|
+
@hResponseObj[:writerMessages] << 'Local Coordinate System is missing description'
|
28
|
+
end
|
29
|
+
|
30
|
+
# local system (local) - local coordinate system georeference information (required)
|
31
|
+
unless hProjection[:localPlanarGeoreference].nil?
|
32
|
+
@xml.tag!('localgeo', hProjection[:localPlanarGeoreference])
|
33
|
+
end
|
34
|
+
if hProjection[:localPlanarGeoreference].nil?
|
35
|
+
@hResponseObj[:writerPass] = false
|
36
|
+
@hResponseObj[:writerMessages] << 'Local Coordinate System is missing georeference information'
|
37
|
+
end
|
38
|
+
|
39
|
+
end # writeXML
|
40
|
+
end # LocalSystem
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# FGDC <<Class>> SpatialReference
|
2
|
+
# FGDC CSDGM writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-01-12 original script
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
module Fgdc
|
11
|
+
|
12
|
+
class CoordinateInformation
|
13
|
+
|
14
|
+
def initialize(xml, hResponseObj)
|
15
|
+
@xml = xml
|
16
|
+
@hResponseObj = hResponseObj
|
17
|
+
end
|
18
|
+
|
19
|
+
def writeXML(aRepTypes, aResolutions)
|
20
|
+
|
21
|
+
haveCInfo = false
|
22
|
+
haveCInfo = true unless aRepTypes.empty?
|
23
|
+
aResolutions.each do |hResolution|
|
24
|
+
haveCInfo = true if hResolution[:coordinateResolution]
|
25
|
+
haveCInfo = true if hResolution[:bearingDistanceResolution]
|
26
|
+
end
|
27
|
+
unitOfMeasure = nil
|
28
|
+
|
29
|
+
# coordinate information 4.1.2.4 (planci) - planar coordinate information
|
30
|
+
if haveCInfo
|
31
|
+
@xml.tag!('planar') do
|
32
|
+
@xml.tag!('planci') do
|
33
|
+
|
34
|
+
# coordinate information 4.1.2.4.1 (plance) - planar coordinate encoding method (required)
|
35
|
+
# <- spatialRepresentationTypes[].first
|
36
|
+
unless aRepTypes.empty?
|
37
|
+
@xml.tag!('plance', aRepTypes[0])
|
38
|
+
end
|
39
|
+
if aRepTypes.empty?
|
40
|
+
@hResponseObj[:writerPass] = false
|
41
|
+
@hResponseObj[:writerMessages] << 'Planar Coordinate Information is missing encoding method'
|
42
|
+
end
|
43
|
+
|
44
|
+
# <- spatialResolutions[] look for coordinateResolution and bearingDistanceResolution
|
45
|
+
# take first encountered, only one is permitted from file
|
46
|
+
aResolutions.each do |hResolution|
|
47
|
+
unless hResolution[:coordinateResolution].empty?
|
48
|
+
hCoordRes = hResolution[:coordinateResolution]
|
49
|
+
|
50
|
+
# coordinate information 4.1.2.4.2 (coordrep) - coordinate representation
|
51
|
+
@xml.tag!('coordrep') do
|
52
|
+
|
53
|
+
# coordinate information 4.1.2.4.2.1 (absres) - abscissa resolution (required)
|
54
|
+
unless hCoordRes[:abscissaResolutionX].nil?
|
55
|
+
@xml.tag!('absres', hCoordRes[:abscissaResolutionX].to_f)
|
56
|
+
end
|
57
|
+
if hCoordRes[:abscissaResolutionX].nil?
|
58
|
+
@hResponseObj[:writerPass] = false
|
59
|
+
@hResponseObj[:writerMessages] << 'Coordinate Representation is missing abscissa resolution'
|
60
|
+
end
|
61
|
+
|
62
|
+
# coordinate information 4.1.2.4.2.2 (ordres) - ordinate resolution (required)
|
63
|
+
unless hCoordRes[:ordinateResolutionY].nil?
|
64
|
+
@xml.tag!('ordres', hCoordRes[:ordinateResolutionY].to_f)
|
65
|
+
end
|
66
|
+
if hCoordRes[:ordinateResolutionY].nil?
|
67
|
+
@hResponseObj[:writerPass] = false
|
68
|
+
@hResponseObj[:writerMessages] << 'Coordinate Representation is missing ordinate resolution'
|
69
|
+
end
|
70
|
+
|
71
|
+
# coordinate information 4.1.2.4.4 (plandu) - distance unit of measure (required)
|
72
|
+
unless hCoordRes[:unitOfMeasure].nil?
|
73
|
+
unitOfMeasure = hCoordRes[:unitOfMeasure]
|
74
|
+
end
|
75
|
+
if hCoordRes[:unitOfMeasure].nil?
|
76
|
+
@hResponseObj[:writerPass] = false
|
77
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing planar distance units'
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
break
|
82
|
+
end
|
83
|
+
|
84
|
+
unless hResolution[:bearingDistanceResolution].empty?
|
85
|
+
hBearRes = hResolution[:bearingDistanceResolution]
|
86
|
+
|
87
|
+
# coordinate information 4.1.2.4.3 (distbrep) - bearing and distance representation
|
88
|
+
@xml.tag!('distbrep') do
|
89
|
+
|
90
|
+
# coordinate information 4.1.2.4.3.1 (distres) - distance resolution (required)
|
91
|
+
unless hBearRes[:distanceResolution].nil?
|
92
|
+
@xml.tag!('distres', hBearRes[:distanceResolution].to_f)
|
93
|
+
end
|
94
|
+
if hBearRes[:distanceResolution].nil?
|
95
|
+
@hResponseObj[:writerPass] = false
|
96
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing distance resolution'
|
97
|
+
end
|
98
|
+
|
99
|
+
# coordinate information 4.1.2.4.3.2 (bearres) - bearing resolution (required)
|
100
|
+
unless hBearRes[:bearingResolution].nil?
|
101
|
+
@xml.tag!('bearres', hBearRes[:bearingResolution])
|
102
|
+
end
|
103
|
+
if hBearRes[:bearingResolution].nil?
|
104
|
+
@hResponseObj[:writerPass] = false
|
105
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing bearing resolution'
|
106
|
+
end
|
107
|
+
|
108
|
+
# coordinate information 4.1.2.4.3.3 (bearunit) - bearing units of measure (required)
|
109
|
+
unless hBearRes[:bearingUnitOfMeasure].nil?
|
110
|
+
@xml.tag!('bearunit', hBearRes[:bearingUnitOfMeasure])
|
111
|
+
end
|
112
|
+
if hBearRes[:bearingUnitOfMeasure].nil?
|
113
|
+
@hResponseObj[:writerPass] = false
|
114
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing bearing units'
|
115
|
+
end
|
116
|
+
|
117
|
+
# coordinate information 4.1.2.4.3.4 (bearrefd) - bearing units of measure (required)
|
118
|
+
unless hBearRes[:bearingReferenceDirection].nil?
|
119
|
+
@xml.tag!('bearrefd', hBearRes[:bearingReferenceDirection])
|
120
|
+
end
|
121
|
+
if hBearRes[:bearingReferenceDirection].nil?
|
122
|
+
@hResponseObj[:writerPass] = false
|
123
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing bearing reference direction'
|
124
|
+
end
|
125
|
+
|
126
|
+
# coordinate information 4.1.2.4.3.5 (bearrefm) - bearing reference meridian (required)
|
127
|
+
unless hBearRes[:bearingReferenceMeridian].nil?
|
128
|
+
@xml.tag!('bearrefm', hBearRes[:bearingReferenceMeridian])
|
129
|
+
end
|
130
|
+
if hBearRes[:bearingReferenceMeridian].nil?
|
131
|
+
@hResponseObj[:writerPass] = false
|
132
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing bearing reference meridian'
|
133
|
+
end
|
134
|
+
|
135
|
+
# coordinate information 4.1.2.4.4 (plandu) - distance unit of measure (required)
|
136
|
+
unless hBearRes[:distanceUnitOfMeasure].nil?
|
137
|
+
unitOfMeasure = hBearRes[:distanceUnitOfMeasure]
|
138
|
+
end
|
139
|
+
if hBearRes[:distanceUnitOfMeasure].nil?
|
140
|
+
@hResponseObj[:writerPass] = false
|
141
|
+
@hResponseObj[:writerMessages] << 'Bearing-Distance Representation is missing planar distance units'
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
break
|
146
|
+
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# planar distance units 4.1.2.4.4 (plandu) - (required)
|
151
|
+
# value and error messages handled in above code
|
152
|
+
# just write it out here
|
153
|
+
unless unitOfMeasure.nil?
|
154
|
+
@xml.tag!('plandu', unitOfMeasure)
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
end # writeXML
|
162
|
+
end # CoordinateInformation
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|