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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb', line 19
def self.unpack(hFeatCol, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hFeatCol.empty?
@MessagePath.issueWarning(280, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intFeatCol = intMetadataClass.newFeatureCollection
if hFeatCol.has_key?('type')
unless hFeatCol['type'] == ''
if hFeatCol['type'] == 'FeatureCollection'
intFeatCol[:type] = hFeatCol['type']
else
@MessagePath.issueError(281, responseObj)
end
end
end
if intFeatCol[:type].nil? || intFeatCol[:type] == ''
@MessagePath.issueError(282, responseObj)
end
if hFeatCol.has_key?('bbox')
unless hFeatCol['bbox'].empty?
intFeatCol[:bbox] = hFeatCol['bbox']
end
end
if hFeatCol.has_key?('features')
hFeatCol['features'].each do |hFeature|
hReturn = GeoJson.unpack(hFeature, responseObj)
unless hReturn.nil?
intFeatCol[:features] << hReturn
end
end
else
@MessagePath.issueError(283, responseObj)
end
unless intFeatCol[:features].empty?
intFeatCol[:computedBbox] = AdiwgCoordinates.computeBbox(intFeatCol[:features])
end
intFeatCol[:nativeGeoJson] = hFeatCol
return intFeatCol
end
|