Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIlya Zverev <zverik@textual.ru>2018-05-23 18:26:41 +0300
committerSlava <slovaricheg@gmail.com>2018-06-08 15:06:49 +0300
commit34db723f4f5480e31b2233615c9366951add5e0f (patch)
treee4a6aaaa7fa4604dcd516ecc31aa973d1fff19f1 /tools
parent5e0afc72c0dd8eacab9f52f34390571c5adb2fbf (diff)
Fix extract_addr generation and a small bug in mwm.py
Diffstat (limited to 'tools')
-rwxr-xr-xtools/python/mwm/decode_id.py12
-rw-r--r--tools/python/mwm/mwm.py8
2 files changed, 16 insertions, 4 deletions
diff --git a/tools/python/mwm/decode_id.py b/tools/python/mwm/decode_id.py
new file mode 100755
index 0000000000..376c91295f
--- /dev/null
+++ b/tools/python/mwm/decode_id.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+import sys
+import mwm
+
+if len(sys.argv) < 2:
+ print('This script unpacks maps.me OSM id to an OSM object link.')
+ print('Usage: {} <id>'.format(sys.argv[0]))
+
+osm_id = mwm.unpack_osmid(int(sys.argv[1]))
+type_abbr = {'n': 'node', 'w': 'way', 'r': 'relation'}
+print('https://www.openstreetmap.org/{}/{}'.format(
+ type_abbr[osm_id[0]], osm_id[1]))
diff --git a/tools/python/mwm/mwm.py b/tools/python/mwm/mwm.py
index 4784f98b67..3259a518d1 100644
--- a/tools/python/mwm/mwm.py
+++ b/tools/python/mwm/mwm.py
@@ -496,12 +496,12 @@ RESET = ~(NODE | WAY | RELATION)
def unpack_osmid(num):
- if num & NODE == NODE:
- typ = 'n'
+ if num & RELATION == RELATION:
+ typ = 'r'
elif num & WAY == WAY:
typ = 'w'
- elif num & RELATION == RELATION:
- typ = 'r'
+ elif num & NODE == NODE:
+ typ = 'n'
else:
return None
return typ, num & RESET