module ADIWG::Mdtranslator::Readers::SbJson::Spatial

Public Class Methods

unpack(hSbJson, hResourceInfo, hResponseObj) click to toggle source
# 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