Sha256: 3bf0e55d87531cabcfb5b592e3f0e72e68e5f3b966333c631a6fd68e8ee87e1e
Contents?: true
Size: 966 Bytes
Versions: 4
Compression:
Stored size: 966 Bytes
Contents
module GeoKit class LatLng def valid? self.lat and self.lng and self.lat >= -90 and self.lat <= 90 and self.lng >= -180 and self.lng <= 180 end # DEPRECATED # Use Point geometry which supports srid 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 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 def proj4_point(ratio = 1) Proj4::Point.new(lng * ratio, lat * ratio) end def self.from_pro4j(point, ratio = 1) new point.lat * ratio, point.lon * ratio end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
georuby-ext-0.0.5 | lib/georuby-ext/geokit.rb |
georuby-ext-0.0.4 | lib/georuby-ext/geokit.rb |
georuby-ext-0.0.3 | lib/georuby-ext/geokit.rb |
georuby-ext-0.0.2 | lib/georuby-ext/geokit.rb |