Class: Underpass::QL::Query
- Inherits:
-
Object
- Object
- Underpass::QL::Query
- Defined in:
- lib/underpass/ql/query.rb
Overview
High-level entry point for querying the Overpass API.
Glues together Request, Client, Response, QueryAnalyzer, and Matcher to provide a single-call interface.
Class Method Summary collapse
-
.perform(bounding_box, query) ⇒ Array<Feature>
Queries the Overpass API within a bounding box.
-
.perform_in_area(area_name, query) ⇒ Array<Feature>
Queries the Overpass API within a named area (e.g. “Romania”).
-
.perform_raw(query_body) ⇒ Array<Feature>
Executes a pre-built query body that includes its own inline bbox.
Class Method Details
.perform(bounding_box, query) ⇒ Array<Feature>
Queries the Overpass API within a bounding box.
29 30 31 32 33 34 |
# File 'lib/underpass/ql/query.rb', line 29 def self.perform(bounding_box, query) query_string = resolve_query(query) op_bbox = Underpass::QL::BoundingBox.from_geometry(bounding_box) request = Underpass::QL::Request.new(query_string, op_bbox) execute(request, query_string) end |
.perform_in_area(area_name, query) ⇒ Array<Feature>
Queries the Overpass API within a named area (e.g. “Romania”).
44 45 46 47 48 |
# File 'lib/underpass/ql/query.rb', line 44 def self.perform_in_area(area_name, query) query_string = resolve_query(query) request = Underpass::QL::Request.new(query_string, nil, area_name: area_name) execute(request, query_string) end |
.perform_raw(query_body) ⇒ Array<Feature>
Executes a pre-built query body that includes its own inline bbox. Wraps it in the standard Request template for output format and timeout, without adding a global bounding box.
60 61 62 63 |
# File 'lib/underpass/ql/query.rb', line 60 def self.perform_raw(query_body) request = Underpass::QL::Request.new(query_body, nil) execute(request, query_body) end |