Skip to content

Commit 6a72c11

Browse files
committed
adding bbox, reorganizing
1 parent b58fa8a commit 6a72c11

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Overpass/Overpass.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ class API(object):
66
"""A simple Python wrapper for the OpenStreetMap Overpass API"""
77

88
# defaults for the API class
9-
TIMEOUT = 25 # seconds
10-
ENDPOINT = "http://overpass-api.de/api/interpreter"
11-
RESPONSE_FORMAT = "json"
12-
DEBUG = False
9+
_timeout = 25 # seconds
10+
_endpoint = "http://overpass-api.de/api/interpreter"
11+
_responseformat = "json"
12+
_debug = False
13+
_bbox = [-180.0, -90.0, 180.0, 90.0]
1314

1415
def __init__(self, *args, **kwargs):
15-
self.endpoint = kwargs.get("endpoint", self.ENDPOINT)
16-
self.timeout = kwargs.get("timeout", self.TIMEOUT)
17-
self.debug = kwargs.get("debug", self.DEBUG)
18-
self.response_format = kwargs.get("response_format", self.RESPONSE_FORMAT)
16+
self.endpoint = kwargs.get("endpoint", self._endpoint)
17+
self.timeout = kwargs.get("timeout", self._timeout)
18+
self.responseformat = kwargs.get("responseformat", self._responseformat)
19+
self.debug = kwargs.get("debug", self._debug)
20+
self.bbox = kwargs.get("bbox", self._bbox)
1921
self._status = None
2022

2123
if self.debug:
@@ -53,7 +55,7 @@ def _ConstructError(self, msg):
5355

5456
def _ConstructQLQuery(self, userquery):
5557
if self.debug:
56-
print "[out:{response_format}];".format(response_format=self.response_format) + userquery + "out body;"
58+
print "[out:{responseformat}];".format(responseformat=self.responseformat) + userquery + "out body;"
5759
if not userquery.endswith(";"):
5860
userquery += ";"
5961
return "[out:json];" + userquery + "out body;"

0 commit comments

Comments
 (0)