Class: Proj4::Projection

Inherits:
Object
  • Object
show all
Defined in:
lib/georuby-ext/proj4.rb

Constant Summary collapse

@@wgs84 =
nil
@@goggle =
nil

Class Method Summary collapse

Class Method Details

.for_srid(srid) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/georuby-ext/proj4.rb', line 13

def self.for_srid(srid)
  case srid
  when 4326
    wgs84
  when 900913
    google
  else
    begin 
      Proj4::Projection.new 'init=epsg:'+srid.to_s
    rescue
      raise "Unsupported srid: #{srid}"
    end
  end
end

.googleObject



9
10
11
# File 'lib/georuby-ext/proj4.rb', line 9

def self.google
  @@google ||= Proj4::Projection.new '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs'
end

.wgs84Object



4
5
6
# File 'lib/georuby-ext/proj4.rb', line 4

def self.wgs84
  @@wgs84 ||= Proj4::Projection.new '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
end