Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 2ce5f86

Browse files
committed
Added verbosity options to the return
This change allows users to add in any of the verbosity or modificator options that they want without breaking any calls that expect "out body;".
1 parent de0a901 commit 2ce5f86

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

overpass/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class API(object):
1515
_endpoint = "http://overpass-api.de/api/interpreter"
1616
_debug = False
1717

18-
_QUERY_TEMPLATE = "[out:{out}];{query}out body;"
18+
_QUERY_TEMPLATE = "[out:{out}];{query}out {verbosity};"
1919
_GEOJSON_QUERY_TEMPLATE = "[out:json];{query}out body geom;"
2020

2121
def __init__(self, *args, **kwargs):
@@ -35,11 +35,11 @@ def __init__(self, *args, **kwargs):
3535
requests_log.setLevel(logging.DEBUG)
3636
requests_log.propagate = True
3737

38-
def Get(self, query, responseformat="geojson"):
38+
def Get(self, query, responseformat="geojson", verbosity="body"):
3939
"""Pass in an Overpass query in Overpass QL"""
4040

4141
# Construct full Overpass query
42-
full_query = self._ConstructQLQuery(query, responseformat=responseformat)
42+
full_query = self._ConstructQLQuery(query, responseformat=responseformat, verbosity=verbosity)
4343

4444
# Get the response from Overpass
4545
raw_response = self._GetFromOverpass(full_query)
@@ -68,17 +68,17 @@ def Search(self, feature_type, regex=False):
6868
"""Search for something."""
6969
raise NotImplementedError()
7070

71-
def _ConstructQLQuery(self, userquery, responseformat):
71+
def _ConstructQLQuery(self, userquery, responseformat, verbosity):
7272
raw_query = str(userquery)
7373
if not raw_query.endswith(";"):
7474
raw_query += ";"
7575

7676
if responseformat == "geojson":
7777
template = self._GEOJSON_QUERY_TEMPLATE
78-
complete_query = template.format(query=raw_query)
78+
complete_query = template.format(query=raw_query, verbosity=verbosity)
7979
else:
8080
template = self._QUERY_TEMPLATE
81-
complete_query = template.format(query=raw_query, out=responseformat)
81+
complete_query = template.format(query=raw_query, out=responseformat, verbosity=verbosity)
8282

8383
if self.debug:
8484
print(complete_query)

0 commit comments

Comments
 (0)