Class: RubyVolt::DataType::GeographyPoint
- Inherits:
-
FixedSize
- Object
- RubyVolt::DataType
- Basic
- FixedSize
- RubyVolt::DataType::GeographyPoint
- Defined in:
- lib/ruby_volt/data_type/basic/fixed_size/geography_point.rb
Constant Summary collapse
- DIRECTIVE =
"G2"- LENGTH =
16
Class Method Summary collapse
Methods inherited from Basic
Methods inherited from RubyVolt::DataType
classifyDataType, testpacking, voltDataType
Class Method Details
.pack(point) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/ruby_volt/data_type/basic/fixed_size/geography_point.rb', line 8 def pack(point) # A GeographyPointValue's wire protocol representation is simply two double precision numbers in sequence. The first is the longitude, and must be in the range -180 ≤ longitude ≤ 180. The second is the latitude, and must be in the range -90 ≤ latitude ≤ 90. The null GeographyPoint value has longitude and latitude both equal to 360.0. if point.nil? lng, lat = 360.0, 360.0 else lng, lat = point.lng, point.lat end [lng, lat].pack(self::DIRECTIVE) end |