class PlusCodes::CodeArea
CodeArea
-
contains coordinates of a decoded Open Location Code(Plus+Codes).
The coordinates include the latitude and longitude of the lower left and upper right corners and the center of the bounding box for the area the code represents.
@author We-Ming Wu
Attributes
latitude_center[RW]
latitude_height[RW]
longitude_center[RW]
longitude_width[RW]
south_latitude[RW]
west_longitude[RW]
Public Class Methods
new(south_latitude, west_longitude, latitude_height, longitude_width)
click to toggle source
Creates a [CodeArea].
@param south_latitude
[Numeric] the latitude of the SW corner in degrees @param west_longitude
[Numeric] the longitude of the SW corner in degrees @param latitude_height
[Numeric] the height from the SW corner in degrees @param longitude_width
[Numeric] the width from the SW corner in degrees @return [CodeArea] a code area which contains the coordinates
# File lib/plus_codes/code_area.rb, line 20 def initialize(south_latitude, west_longitude, latitude_height, longitude_width) @south_latitude = south_latitude @west_longitude = west_longitude @latitude_height = latitude_height @longitude_width = longitude_width @latitude_center = south_latitude + latitude_height / 2.0 @longitude_center = west_longitude + longitude_width / 2.0 end
Public Instance Methods
east_longitude()
click to toggle source
# File lib/plus_codes/code_area.rb, line 33 def east_longitude @west_longitude + @longitude_width end
north_latitude()
click to toggle source
# File lib/plus_codes/code_area.rb, line 29 def north_latitude @south_latitude + @latitude_height end