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
|
# File 'lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_geographicExtent.rb', line 27
def self.build(aExtents)
aFeatureCollection = []
aExtents.each do |hExtent|
hExtent[:geographicExtents].each do |hGeoExtent|
collection = new_collection()
hGeoExtent[:nativeGeoJson].each do |hGeoObj|
case hGeoObj['type']
when 'Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon'
feature = new_feature()
feature['geometry'] = hGeoObj
collection['features'] << feature
when 'GeometryCollection'
geoCollection = new_collection()
hGeoObj['geometries'].each do |hGeometry|
feature = new_feature()
feature['geometry'] = hGeometry
geoCollection['features'] << feature
end
aFeatureCollection << geoCollection
when 'Feature'
collection['features'] << hGeoObj
when 'FeatureCollection'
aFeatureCollection << hGeoObj
end
end
unless collection['features'].empty?
aFeatureCollection << collection
end
end
end
aFeatureCollection
end
|