Class: GeoRuby::SimpleFeatures::Point

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

Instance Method Summary collapse

Instance Method Details

#to_wkt_bounding_box(range) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/georuby_box.rb', line 11

def to_wkt_bounding_box range
  tl_point = Point.from_x_y(x-range, y-range)
  tr_point = Point.from_x_y(x+range, y-range)
  br_point = Point.from_x_y(x+range, y+range)
  bl_point = Point.from_x_y(x-range, y+range)
  points_text = [
    tl_point.to_x_y, 
    tr_point.to_x_y, 
    br_point.to_x_y, 
    bl_point.to_x_y, 
    tl_point.to_x_y
  ].join(',')
  "GeomFromText('Polygon((#{points_text}))')"
end

#to_x_yObject



7
8
9
# File 'lib/georuby_box.rb', line 7

def to_x_y
  "#{x} #{y}"
end