No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for OpenStreetMap Overpass API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 0.10
~> 12.0
~> 3.6

Runtime

~> 2.4
 Project Readme

Overpass API Ruby CircleCI

A Ruby wrapper for OpenStreetMap Overpass API. Supports both QL and XML.

Note: Version 0.2 introduces breaking changes. Check the file CHANGELOG.md.

Install

gem install overpass-api-ruby

or add gem 'overpass-api-ruby' to your Gemfile

Usage

Using XML:

require 'overpass_api_ruby'

options={:bbox => {:s => -34.705448, :n => -34.526562,
                   :w => -58.531471, :e => -58.335159},
         :timeout => 900,
         :element_limit => 1073741824}

overpass = OverpassAPI::XML.new(options)

query = "<union><query type='relation'><has-kv k='route' v='subway'/></query>" <<
        "</union><union><item/><recurse type='down'/></union>"

response = overpass.query(query)

Using QL:

require 'overpass_api_ruby'

options={:bbox => {:s => -34.705448, :n => -34.526562,
                   :w => -58.531471, :e => -58.335159},
         :timeout => 900,
         :maxsize => 1073741824}

overpass = OverpassAPI::QL.new(options)

query = "rel['route'='subway'];(._;>;);out body;"

response = overpass.query(query)

Common options on instantiation

bbox                    Hash. Global bounding box.
endpoint                String.
                        Defaults to http://overpass-api.de/api/interpreter
timeout                 Integer.

Specific options on instantiation

QL

maxsize                 Integer.

XML

element_limit           Integer.

See Overpass API

Public methods

Both QL and XML classes have the same public methods:

query (<String query>)      Performs the query passed using the global values set on instantiation.

raw_query (<String query>)  The whole query must be passed.

buid_query (<String query>) Returns a String containing the whole query.

bounding_box (s,n,w,e)      Defines the global bounding box.

Test

Run rake spec

License

MIT.