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

#_validate_geometryObject



114
115
116
117
118
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 114

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

#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
    PointImpl.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