Class: Underpass::QL::BoundingBox
- Inherits:
-
Object
- Object
- Underpass::QL::BoundingBox
- Defined in:
- lib/underpass/ql/bounding_box.rb
Overview
Converts RGeo geometries and WKT strings into Overpass QL bounding box syntax.
Class Method Summary collapse
-
.from_geometry(geometry) ⇒ String
Returns the Overpass QL bounding box string from an RGeo geometry.
-
.from_wkt(wkt) ⇒ String
Returns the Overpass QL bounding box string from a WKT string.
Class Method Details
.from_geometry(geometry) ⇒ String
Returns the Overpass QL bounding box string from an RGeo geometry.
21 22 23 24 |
# File 'lib/underpass/ql/bounding_box.rb', line 21 def from_geometry(geometry) r_bb = RGeo::Cartesian::BoundingBox.create_from_geometry(geometry) "bbox:#{r_bb.min_y},#{r_bb.min_x},#{r_bb.max_y},#{r_bb.max_x}" end |
.from_wkt(wkt) ⇒ String
Returns the Overpass QL bounding box string from a WKT string.
12 13 14 15 |
# File 'lib/underpass/ql/bounding_box.rb', line 12 def from_wkt(wkt) geometry = RGeo::Geographic.spherical_factory.parse_wkt(wkt) from_geometry(geometry) end |