From bb832078d7fed93219404b6cb4b83f937cdb3fb4 Mon Sep 17 00:00:00 2001 From: mvexel Date: Wed, 21 Dec 2016 15:27:11 -0700 Subject: [PATCH] adding utility class --- overpass/__init__.py | 1 + overpass/utils.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 overpass/utils.py diff --git a/overpass/__init__.py b/overpass/__init__.py index 267865a7b4d..9ddfcd7477d 100644 --- a/overpass/__init__.py +++ b/overpass/__init__.py @@ -11,3 +11,4 @@ from .errors import ( OverpassError, OverpassSyntaxError, TimeoutError, MultipleRequestsError, ServerLoadError, UnknownOverpassError ) +from .utils import * \ No newline at end of file diff --git a/overpass/utils.py b/overpass/utils.py new file mode 100644 index 00000000000..9cf3f1236a3 --- /dev/null +++ b/overpass/utils.py @@ -0,0 +1,9 @@ +class Utils(object): + + @classmethod + def to_overpass_id(self, osmid, area=False): + AREA_BASE = 2400000000 + RELATION_BASE = 3600000000 + if area: + return int(osmid) + AREA_BASE + return int(osmid) + RELATION_BASE \ No newline at end of file