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


190
191
192
193
194
195
196
197
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 190

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

#_validate_geometryObject


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

def _validate_geometry
  @y = 85.0511287 if @y > 85.0511287
  @y = -85.0511287 if @y < -85.0511287
  super
end

#canonical_pointObject


181
182
183
184
185
186
187
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 181

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

#canonical_xObject Also known as: canonical_longitude, canonical_lon


172
173
174
175
176
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 172

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