Class: CartoJson::Rectangle

Inherits:
Object
  • Object
show all
Defined in:
lib/carto_json/rectangle.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Rectangle

Returns a new instance of Rectangle.



3
4
5
6
7
8
# File 'lib/carto_json/rectangle.rb', line 3

def initialize(opts={})
  raise "sw and ne coordinates are required" unless opts[:sw] && opts[:ne]
  @sw = opts[:sw].to_f
  @ne = opts[:ne].to_f
  raise "sw and ne coordinates cannot be equal" if @sw == @ne
end

Instance Method Details

#to_wktObject



10
11
12
# File 'lib/carto_json/rectangle.rb', line 10

def to_wkt
  
end