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



165
166
167
168
169
170
171
172
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 165

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



157
158
159
160
161
162
163
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 157

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



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

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