Module: ADIWG::Mdtranslator::Readers::SbJson::Spatial

Defined in:
lib/adiwg/mdtranslator/readers/sbJson/modules/module_spatial.rb

Class Method Summary collapse

Class Method Details

.unpack(hSbJson, hResourceInfo, hResponseObj) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/readers/sbJson/modules/module_spatial.rb', line 16

def self.unpack(hSbJson, hResourceInfo, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new

   if hSbJson.has_key?('spatial')
      unless hSbJson['spatial'].empty?
         # representational point is not mapped
         # map bounding box
         if hSbJson['spatial'].has_key?('boundingBox')
            hSbBbox = hSbJson['spatial']['boundingBox']
            unless hSbBbox.empty?

               hExtent = intMetadataClass.newExtent
               hGeoExtent = intMetadataClass.newGeographicExtent
               hBbox = intMetadataClass.newBoundingBox

               hBbox[:westLongitude] = hSbBbox['minX']
               hBbox[:eastLongitude] = hSbBbox['maxX']
               hBbox[:southLatitude] = hSbBbox['minY']
               hBbox[:northLatitude] = hSbBbox['maxY']

               hGeoExtent[:boundingBox] = hBbox
               hExtent[:geographicExtents] << hGeoExtent
               hResourceInfo[:extents] << hExtent

            end
         end
      end
   end

   return hResourceInfo

end