Class: OverpassAPI::QL

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

Overview

builds queries in overpass ql format

Constant Summary

Constants inherited from Base

Base::DEFAULT_ENDPOINT

Instance Method Summary collapse

Methods inherited from Base

#bounding_box, #query, #raw_query

Constructor Details

#initialize(args = {}) ⇒ QL

Returns a new instance of QL.



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

def initialize(args = {})
  super
  @maxsize = args[:maxsize]
end

Instance Method Details

#build_query(query) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/ql.rb', line 11

def build_query(query)
  header = ''
  header << "[bbox:#{@bbox}]" if @bbox
  header << "[timeout:#{@timeout}]" if @timeout
  header << "[maxsize:#{@maxsize}]" if @maxsize

  header << '[out:json]'

  "#{header};#{query}"
end