Class: Groonga::TokyoGeoPoint

Inherits:
GeoPoint
  • Object
show all
Defined in:
lib/groonga/geo-point.rb

Instance Attribute Summary

Attributes inherited from GeoPoint

#latitude, #longitude

Instance Method Summary collapse

Methods inherited from GeoPoint

#==, #degree?, #initialize, #inspect, #msec?, parse, #to_degree, #to_msec, #to_s

Constructor Details

This class inherits a constructor from Groonga::GeoPoint

Instance Method Details

#to_tokyoObject



153
154
155
# File 'lib/groonga/geo-point.rb', line 153

def to_tokyo
  self
end

#to_wgs84Object

TODO: write document

TokyoGeoPoint <-> WGS84GeoPoint is based on http://www.jalan.net/jw/jwp0200/jww0203.do

jx: longitude in degree in Tokyo Geodetic System. jy: latitude in degree in Tokyo Geodetic System. wx: longitude in degree in WGS 84. wy: latitude in degree in WGS 84.

jy = wy * 1.000106961 - wx * 0.000017467 - 0.004602017 jx = wx * 1.000083049 + wy * 0.000046047 - 0.010041046

wy = jy - jy * 0.00010695 + jx * 0.000017464 + 0.0046017 wx = jx - jy * 0.000046038 - jx * 0.000083043 + 0.010040



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/groonga/geo-point.rb', line 172

def to_wgs84
  in_degree = to_degree
  wgs84_latitude_in_degree =
    in_degree.latitude -
    in_degree.latitude * 0.00010695 +
    in_degree.longitude * 0.000017464 +
    0.0046017
  wgs84_longitude_in_degree =
    in_degree.longitude -
    in_degree.latitude * 0.000046038 -
    in_degree.longitude * 0.000083043 +
    0.010040
  WGS84GeoPoint.new(wgs84_latitude_in_degree, wgs84_longitude_in_degree)
end