lib/rgeo/geography/simple_mercator/projector.rb in rgeo-0.1.12 vs lib/rgeo/geography/simple_mercator/projector.rb in rgeo-0.1.13

- old
+ new

@@ -36,25 +36,21 @@ module RGeo module Geography - module SimpleMercator + module SimpleMercator # :nodoc: EQUATORIAL_RADIUS = 6378137.0 - class Projector + class Projector # :nodoc: def initialize(geography_factory_, opts_={}) @geography_factory = geography_factory_ - if ::RGeo.const_defined?(:Geos) && Geos.supported? - @projection_factory = Geos.factory(:srid => 3857, :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions]) - else - @projection_factory = nil - end + @projection_factory = Cartesian.preferred_factory(:srid => 3857, :buffer_resolution => opts_[:buffer_resolution], :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions]) end def projection_factory @projection_factory @@ -67,10 +63,10 @@ def unproject(geometry_) case geometry_ when Features::Point - dpr_ = Common::Helper::DEGREES_PER_RADIAN + dpr_ = Helper::DEGREES_PER_RADIAN radius_ = EQUATORIAL_RADIUS @geography_factory.point(geometry_.x / radius_ * dpr_, (2.0 * ::Math.atan(::Math.exp(geometry_.y / radius_)) - ::Math::PI / 2.0) * dpr_) when Features::Line @geography_factory.line(unproject(geometry_.start_point), unproject(geometry_.end_point))