Sha256: fa10cc6742c940f58e08d1942522cf7a0f06b6ef1c2f06f5776528b0743394ce

Contents?: true

Size: 1.86 KB

Versions: 26

Compression:

Stored size: 1.86 KB

Contents

module ADIWG
    module Mdtranslator
        module Readers
            module SbJson

                module BoundingBox

                    def self.unpack(aBBox, responseObj)

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intGeometry = intMetadataClass.newGeometry
                        intGeometry[:geoType] = 'BoundingBox'

                        # unpack GeoJSON bounding box elements
                        intBBox = intMetadataClass.newBoundingBox
                        west = aBBox[0]
                        south = aBBox[1]
                        east = aBBox[2]
                        north = aBBox[3]

                        # validate coordinates if easting +/-180 and northing +/-90
                        valid = false
                        if (180 >= west) && (west >= -180)
                            if (90 >= south) && (south >= -90)
                                if (180 >= east) && (east >= -180)
                                    if (90 >= north) &&(north >= -90)
                                        valid = true
                                    end
                                end
                            end
                        end

                        # build internal geo element if valid
                        if valid
                            intBBox[:westLong] = west
                            intBBox[:eastLong] = east
                            intBBox[:southLat] = south
                            intBBox[:northLat] = north
                            intGeometry[:geometry] = intBBox

                            return intGeometry
                        else
                            return nil
                        end

                    end

                end

            end
        end
    end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.0.0rc13 lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc11 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc10 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc9 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc8 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc7 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc6 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc5 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc4 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc3 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-2.0.0rc2 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta14 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta13 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta12 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta11 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta10 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta9 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta8 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb
adiwg-mdtranslator-1.4.0.beta7 lib/adiwg/mdtranslator/readers/sbJson/modules_v0/module_boundingBox.rb