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