Class: Underpass::QL::Shape
- Inherits:
-
Object
- Object
- Underpass::QL::Shape
- Defined in:
- lib/underpass/ql/shape.rb
Overview
Contains factories for various RGeo shapes from ways and nodes parsed with the Parser class
Class Method Summary collapse
Class Method Details
.line_string_from_way(way, nodes) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/underpass/ql/shape.rb', line 13 def self.line_string_from_way(way, nodes) f = RGeo::Geographic.spherical_factory(srid: 4326) f.line_string( way[:nodes].map do |n| f.point(nodes[n][:lon], nodes[n][:lat]) end ) end |
.polygon_from_way(way, nodes) ⇒ Object
8 9 10 11 |
# File 'lib/underpass/ql/shape.rb', line 8 def self.polygon_from_way(way, nodes) f = RGeo::Geographic.spherical_factory(srid: 4326) f.polygon(line_string_from_way(way, nodes)) end |