Class: GeoKit::LatLng
- Inherits:
-
Object
- Object
- GeoKit::LatLng
- Defined in:
- lib/georuby-ext/geokit.rb
Class Method Summary collapse
Instance Method Summary collapse
- #google_to_wgs84 ⇒ Object
- #proj4_point(ratio = 1) ⇒ Object
- #valid? ⇒ Boolean
-
#wgs84_to_google ⇒ Object
DEPRECATED Use Point geometry which supports srid.
Class Method Details
Instance Method Details
#google_to_wgs84 ⇒ Object
18 19 20 21 |
# File 'lib/georuby-ext/geokit.rb', line 18 def google_to_wgs84 ActiveSupport::Deprecation.warn "use Point geometry which supports srid" self.class.from_pro4j Proj4::Projection.google.transform(Proj4::Projection.wgs84, self.proj4_point.x, self.proj4_point.y), 180 / Math::PI end |
#proj4_point(ratio = 1) ⇒ Object
23 24 25 |
# File 'lib/georuby-ext/geokit.rb', line 23 def proj4_point(ratio = 1) Proj4::Point.new(lng * ratio, lat * ratio) end |
#valid? ⇒ Boolean
4 5 6 7 8 |
# File 'lib/georuby-ext/geokit.rb', line 4 def valid? self.lat and self.lng and self.lat >= -90 and self.lat <= 90 and self.lng >= -180 and self.lng <= 180 end |
#wgs84_to_google ⇒ Object
DEPRECATED Use Point geometry which supports srid
13 14 15 16 |
# File 'lib/georuby-ext/geokit.rb', line 13 def wgs84_to_google ActiveSupport::Deprecation.warn "use Point geometry which supports srid" self.class.from_pro4j Proj4::Projection.wgs84.transform Proj4::Projection.google, self.proj4_point(Math::PI / 180).x, self.proj4_point(Math::PI / 180).y end |