adiwg-mdtranslator 2.9.2 → 2.10.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 +30 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
- data/lib/adiwg/mdtranslator/version.rb +9 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
- data/lib/adiwg/mdtranslator.rb +177 -165
- data/lib/adiwg/mdtranslator_cli.rb +8 -3
- metadata +2 -2
@@ -1,113 +1,128 @@
|
|
1
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
1
2
|
# unpack georectified representation
|
2
3
|
# Reader - ADIwg JSON to internal data structure
|
3
4
|
|
4
5
|
# History:
|
6
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
7
|
# Stan Smith 2016-10-19 original script
|
6
8
|
|
7
9
|
require_relative 'module_gridRepresentation'
|
8
10
|
|
9
11
|
module ADIWG
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
if intGeoRec[:gridRepresentation].empty?
|
40
|
-
responseObj[:readerExecutionMessages] << 'Georectified Representation is missing GridRepresentation object'
|
41
|
-
responseObj[:readerExecutionPass] = false
|
42
|
-
return nil
|
43
|
-
end
|
44
|
-
|
45
|
-
# georectified representation - check point availability (required)
|
46
|
-
if hGeoRec.has_key?('checkPointAvailable')
|
47
|
-
if hGeoRec['checkPointAvailable'] === true
|
48
|
-
intGeoRec[:checkPointAvailable] = hGeoRec['checkPointAvailable']
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# georectified representation - check point description
|
53
|
-
if hGeoRec.has_key?('checkPointDescription')
|
54
|
-
if hGeoRec['checkPointDescription'] != ''
|
55
|
-
intGeoRec[:checkPointDescription] = hGeoRec['checkPointDescription']
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# georectified representation - corner points [2 or 4] (required)
|
60
|
-
if hGeoRec.has_key?('cornerPoints')
|
61
|
-
unless hGeoRec['cornerPoints'].empty?
|
62
|
-
intGeoRec[:cornerPoints] = hGeoRec['cornerPoints']
|
63
|
-
end
|
64
|
-
end
|
65
|
-
unless intGeoRec[:cornerPoints].length == 2 || intGeoRec[:cornerPoints].length == 4
|
66
|
-
responseObj[:readerExecutionMessages] << 'Georectified Representation has invalid cornerPoints array'
|
67
|
-
responseObj[:readerExecutionPass] = false
|
68
|
-
return nil
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module MdJson
|
15
|
+
|
16
|
+
module GeorectifiedRepresentation
|
17
|
+
|
18
|
+
def self.unpack(hGeoRec, responseObj)
|
19
|
+
|
20
|
+
# return nil object if input is empty
|
21
|
+
if hGeoRec.empty?
|
22
|
+
responseObj[:readerExecutionMessages] <<
|
23
|
+
'WARNING: mdJson reader: georectified spatial representation object is empty'
|
24
|
+
return nil
|
25
|
+
end
|
26
|
+
|
27
|
+
# instance classes needed in script
|
28
|
+
intMetadataClass = InternalMetadata.new
|
29
|
+
intGeoRec = intMetadataClass.newGeorectifiedInfo
|
30
|
+
|
31
|
+
# georectified representation - grid representation (required)
|
32
|
+
if hGeoRec.has_key?('gridRepresentation')
|
33
|
+
hObject = hGeoRec['gridRepresentation']
|
34
|
+
unless hObject.empty?
|
35
|
+
hReturn = GridRepresentation.unpack(hObject, responseObj)
|
36
|
+
unless hReturn.nil?
|
37
|
+
intGeoRec[:gridRepresentation] = hReturn
|
69
38
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if intGeoRec[:gridRepresentation].empty?
|
42
|
+
responseObj[:readerExecutionMessages] <<
|
43
|
+
'ERROR: mdJson reader: georectified spatial representation grid representation is missing'
|
44
|
+
responseObj[:readerExecutionPass] = false
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
|
48
|
+
# georectified representation - check point availability (required)
|
49
|
+
if hGeoRec.has_key?('checkPointAvailable')
|
50
|
+
if hGeoRec['checkPointAvailable'] === true
|
51
|
+
intGeoRec[:checkPointAvailable] = hGeoRec['checkPointAvailable']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# georectified representation - check point description
|
56
|
+
if hGeoRec.has_key?('checkPointDescription')
|
57
|
+
if hGeoRec['checkPointDescription'] != ''
|
58
|
+
intGeoRec[:checkPointDescription] = hGeoRec['checkPointDescription']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# georectified representation - corner points [2 or 4] (required)
|
63
|
+
if hGeoRec.has_key?('cornerPoints')
|
64
|
+
unless hGeoRec['cornerPoints'].empty?
|
65
|
+
intGeoRec[:cornerPoints] = hGeoRec['cornerPoints']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
unless intGeoRec[:cornerPoints].length == 2 || intGeoRec[:cornerPoints].length == 4
|
69
|
+
responseObj[:readerExecutionMessages] <<
|
70
|
+
'ERROR: mdJson reader: georectified spatial representation must have either 2 or 4 corner points'
|
71
|
+
responseObj[:readerExecutionPass] = false
|
72
|
+
return nil
|
73
|
+
end
|
74
|
+
|
75
|
+
# georectified representation - center points (required)
|
76
|
+
if hGeoRec.has_key?('centerPoint')
|
77
|
+
unless hGeoRec['centerPoint'].empty?
|
78
|
+
intGeoRec[:centerPoint] = hGeoRec['centerPoint']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
if intGeoRec[:centerPoint].empty?
|
82
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: georectified spatial representation center point is missing'
|
83
|
+
responseObj[:readerExecutionPass] = false
|
84
|
+
return nil
|
85
|
+
end
|
86
|
+
unless intGeoRec[:centerPoint].length == 2
|
87
|
+
responseObj[:readerExecutionMessages] <<
|
88
|
+
'ERROR: mdJson reader: georectified spatial representation center point must be single 2D coordinate'
|
89
|
+
responseObj[:readerExecutionPass] = false
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
|
93
|
+
# georectified representation - point in pixel (required)
|
94
|
+
if hGeoRec.has_key?('pointInPixel')
|
95
|
+
if hGeoRec['pointInPixel'] != ''
|
96
|
+
intGeoRec[:pointInPixel] = hGeoRec['pointInPixel']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if intGeoRec[:pointInPixel].nil?
|
100
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: georectified spatial representation point-in-pixel is missing'
|
101
|
+
responseObj[:readerExecutionPass] = false
|
102
|
+
return nil
|
103
|
+
end
|
104
|
+
|
105
|
+
# georectified representation - transformation dimension description
|
106
|
+
if hGeoRec.has_key?('transformationDimensionDescription')
|
107
|
+
if hGeoRec['transformationDimensionDescription'] != ''
|
108
|
+
intGeoRec[:transformationDimensionDescription] = hGeoRec['transformationDimensionDescription']
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# georectified representation - transformation dimension mapping
|
113
|
+
if hGeoRec.has_key?('transformationDimensionMapping')
|
114
|
+
if hGeoRec['transformationDimensionMapping'] != ''
|
115
|
+
intGeoRec[:transformationDimensionMapping] = hGeoRec['transformationDimensionMapping']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
return intGeoRec
|
120
|
+
|
121
|
+
end
|
109
122
|
|
110
123
|
end
|
111
|
-
|
112
|
-
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
113
128
|
end
|
@@ -2,98 +2,101 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2016-10-19 original script
|
6
7
|
|
7
8
|
require_relative 'module_gridRepresentation'
|
8
9
|
require_relative 'module_citation'
|
9
10
|
|
10
11
|
module ADIWG
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
if intGeoRef[:gridRepresentation].empty?
|
41
|
-
responseObj[:readerExecutionMessages] << 'Georeferenceable Representation is missing GridRepresentation object'
|
42
|
-
responseObj[:readerExecutionPass] = false
|
43
|
-
return nil
|
44
|
-
end
|
45
|
-
|
46
|
-
# georeferenceable representation - control point availability (required)
|
47
|
-
if hGeoRef.has_key?('controlPointAvailable')
|
48
|
-
if hGeoRef['controlPointAvailable'] === true
|
49
|
-
intGeoRef[:controlPointAvailable] = hGeoRef['controlPointAvailable']
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# georeferenceable representation - orientation parameter availability (required)
|
54
|
-
if hGeoRef.has_key?('orientationParameterAvailable')
|
55
|
-
if hGeoRef['orientationParameterAvailable'] === true
|
56
|
-
intGeoRef[:orientationParameterAvailable] = hGeoRef['orientationParameterAvailable']
|
57
|
-
end
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module MdJson
|
15
|
+
|
16
|
+
module GeoreferenceableRepresentation
|
17
|
+
|
18
|
+
def self.unpack(hGeoRef, responseObj)
|
19
|
+
|
20
|
+
# return nil object if input is empty
|
21
|
+
if hGeoRef.empty?
|
22
|
+
responseObj[:readerExecutionMessages] <<
|
23
|
+
'WARNING: mdJson reader: georeferenceable spatial representation object is empty'
|
24
|
+
return nil
|
25
|
+
end
|
26
|
+
|
27
|
+
# instance classes needed in script
|
28
|
+
intMetadataClass = InternalMetadata.new
|
29
|
+
intGeoRef = intMetadataClass.newGeoreferenceableInfo
|
30
|
+
|
31
|
+
# georeferenceable representation - grid representation (required)
|
32
|
+
if hGeoRef.has_key?('gridRepresentation')
|
33
|
+
hObject = hGeoRef['gridRepresentation']
|
34
|
+
unless hObject.empty?
|
35
|
+
hReturn = GridRepresentation.unpack(hObject, responseObj)
|
36
|
+
unless hReturn.nil?
|
37
|
+
intGeoRef[:gridRepresentation] = hReturn
|
58
38
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if intGeoRef[:gridRepresentation].empty?
|
42
|
+
responseObj[:readerExecutionMessages] <<
|
43
|
+
'ERROR: mdJson reader: georeferenceable spatial representation grid representation is missing'
|
44
|
+
responseObj[:readerExecutionPass] = false
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
|
48
|
+
# georeferenceable representation - control point availability (required)
|
49
|
+
if hGeoRef.has_key?('controlPointAvailable')
|
50
|
+
if hGeoRef['controlPointAvailable'] === true
|
51
|
+
intGeoRef[:controlPointAvailable] = hGeoRef['controlPointAvailable']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# georeferenceable representation - orientation parameter availability (required)
|
56
|
+
if hGeoRef.has_key?('orientationParameterAvailable')
|
57
|
+
if hGeoRef['orientationParameterAvailable'] === true
|
58
|
+
intGeoRef[:orientationParameterAvailable] = hGeoRef['orientationParameterAvailable']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# georeferenceable representation - orientation parameter description
|
63
|
+
if hGeoRef.has_key?('orientationParameterDescription')
|
64
|
+
unless hGeoRef['orientationParameterDescription'] == ''
|
65
|
+
intGeoRef[:orientationParameterDescription] = hGeoRef['orientationParameterDescription']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# georeferenceable representation - georeferenced parameter (required)
|
70
|
+
if hGeoRef.has_key?('georeferencedParameter')
|
71
|
+
unless hGeoRef['georeferencedParameter'] == ''
|
72
|
+
intGeoRef[:georeferencedParameter] = hGeoRef['georeferencedParameter']
|
73
|
+
end
|
74
|
+
end
|
75
|
+
if intGeoRef[:georeferencedParameter].nil?
|
76
|
+
responseObj[:readerExecutionMessages] <<
|
77
|
+
'ERROR: mdJson reader: georeferenceable spatial representation georeferenced parameters are missing'
|
78
|
+
responseObj[:readerExecutionPass] = false
|
79
|
+
return nil
|
80
|
+
end
|
81
|
+
|
82
|
+
# georeferenceable representation - parameter citation [citation]
|
83
|
+
if hGeoRef.has_key?('parameterCitation')
|
84
|
+
aCitation = hGeoRef['parameterCitation']
|
85
|
+
aCitation.each do |item|
|
86
|
+
hCitation = Citation.unpack(item, responseObj)
|
87
|
+
unless hCitation.nil?
|
88
|
+
intGeoRef[:parameterCitation] << hCitation
|
65
89
|
end
|
90
|
+
end
|
91
|
+
end
|
66
92
|
|
67
|
-
|
68
|
-
if hGeoRef.has_key?('georeferencedParameter')
|
69
|
-
if hGeoRef['georeferencedParameter'] != ''
|
70
|
-
intGeoRef[:georeferencedParameter] = hGeoRef['georeferencedParameter']
|
71
|
-
end
|
72
|
-
end
|
73
|
-
if intGeoRef[:georeferencedParameter].nil?
|
74
|
-
responseObj[:readerExecutionMessages] << 'Georeferenceable Representation is missing georeferencedParameter'
|
75
|
-
responseObj[:readerExecutionPass] = false
|
76
|
-
return nil
|
77
|
-
end
|
93
|
+
return intGeoRef
|
78
94
|
|
79
|
-
|
80
|
-
if hGeoRef.has_key?('parameterCitation')
|
81
|
-
aCitation = hGeoRef['parameterCitation']
|
82
|
-
aCitation.each do |item|
|
83
|
-
hCitation = Citation.unpack(item, responseObj)
|
84
|
-
unless hCitation.nil?
|
85
|
-
intGeoRef[:parameterCitation] << hCitation
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
return intGeoRef
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
+
end
|
95
96
|
|
96
97
|
end
|
97
|
-
|
98
|
-
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
99
102
|
end
|
@@ -2,54 +2,54 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2016-11-30 original script
|
6
7
|
|
7
8
|
module ADIWG
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
12
|
+
|
13
|
+
module GMLIdentifier
|
14
|
+
|
15
|
+
def self.unpack(hIdentifier, responseObj)
|
16
|
+
|
17
|
+
# return nil object if input is empty
|
18
|
+
if hIdentifier.empty?
|
19
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GML Identifier object is empty'
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# instance classes needed in script
|
24
|
+
intMetadataClass = InternalMetadata.new
|
25
|
+
intIdentifier = intMetadataClass.newIdentifier
|
26
|
+
|
27
|
+
# gml identifier - identifier (required)
|
28
|
+
if hIdentifier.has_key?('identifier')
|
29
|
+
intIdentifier[:identifier] = hIdentifier['identifier']
|
30
|
+
end
|
31
|
+
if intIdentifier[:identifier].nil? || intIdentifier[:identifier] == ''
|
32
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier identifier is missing'
|
33
|
+
responseObj[:readerExecutionPass] = false
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
37
|
+
# gml identifier - namespace (required)
|
38
|
+
if hIdentifier.has_key?('namespace')
|
39
|
+
intIdentifier[:namespace] = hIdentifier['namespace']
|
40
|
+
end
|
41
|
+
if intIdentifier[:namespace].nil? || intIdentifier[:namespace] == ''
|
42
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier namespace is missing'
|
43
|
+
responseObj[:readerExecutionPass] = false
|
44
|
+
return nil
|
45
|
+
end
|
46
|
+
|
47
|
+
return intIdentifier
|
48
|
+
|
49
|
+
end
|
52
50
|
end
|
53
|
-
|
54
|
-
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
55
|
end
|