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


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

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


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

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


120
121
122
123
124
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 120

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