Class: GeoWeb::Projection::Mercator

Inherits:
Base
  • Object
show all
Defined in:
lib/geoweb/projection/mercator.rb

Overview

Mercator OR CylindricMercator?

Instance Attribute Summary

Attributes inherited from Base

#transformation, #zoom

Instance Method Summary collapse

Methods inherited from Base

#coordinate_location, #initialize, #location_coordinate, #project, #unproject

Constructor Details

This class inherits a constructor from GeoWeb::Projection::Base

Instance Method Details

#raw_project(point) ⇒ Object

OK



8
9
10
11
# File 'lib/geoweb/projection/mercator.rb', line 8

def raw_project(point)
  Point.new(point.x,
            Math::log(Math::tan(0.25 * Math::PI + 0.5 * point.y)))
end

#raw_unproject(point) ⇒ Object

OK



14
15
16
17
# File 'lib/geoweb/projection/mercator.rb', line 14

def raw_unproject(point)
  Point.new(point.x,
            2 * Math::atan(Math::E ** point.y) - 0.5 * Math::PI)
end