Module: RGeo::Geographic::ProjectedPointMethods

Included in:
ProjectedPointImpl
Defined in:
lib/rgeo/geographic/projected_feature_methods.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


146
147
148
149
150
151
152
153
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 146

def self.included(klass)
  klass.module_eval do
    alias_method :longitude, :x
    alias_method :lon, :x
    alias_method :latitude, :y
    alias_method :lat, :y
  end
end

Instance Method Details

#canonical_pointObject


138
139
140
141
142
143
144
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 138

def canonical_point
  if @x >= -180.0 && @x < 180.0
    self
  else
    ProjectedPointImpl.new(@factory, canonical_x, @y)
  end
end

#canonical_xObject Also known as: canonical_longitude, canonical_lon


130
131
132
133
134
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 130

def canonical_x
  x_ = @x % 360.0
  x_ -= 360.0 if x_ > 180.0
  x_
end