[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH maposmatic 2/3] cosmetics and main() to test fro
From: |
David Decotigny |
Subject: |
[Maposmatic-dev] [PATCH maposmatic 2/3] cosmetics and main() to test from the cmdline |
Date: |
Mon, 21 Dec 2009 11:47:12 +0100 |
---
www/maposmatic/nominatim.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/www/maposmatic/nominatim.py b/www/maposmatic/nominatim.py
index c02cc81..9dfa1ad 100644
--- a/www/maposmatic/nominatim.py
+++ b/www/maposmatic/nominatim.py
@@ -118,7 +118,7 @@ def _retrieve_missing_data_from_GIS(entries):
admin_boundary_names = set()
PLACE_PRIORITIES = { 'city': 20, 'town': 30, 'municipality': 40,
'village': 50, 'hamlet': 60, 'suburb': 70,
- 'island': 80, 'islet': 90, 'locality': 100}
+ 'island': 80, 'islet': 90, 'locality': 100 }
try:
cursor = conn.cursor()
for entry in entries:
@@ -161,9 +161,9 @@ def _retrieve_missing_data_from_GIS(entries):
% (table_name,entry["osm_id"]))
result = tuple(set(cursor.fetchall()))
if len(result) == 1:
- entry["ocitysmap_params"] = dict(table=table_name,
- id=result[0][0],
-
admin_level=result[0][1])
+ entry["ocitysmap_params"] \
+ = dict(table=table_name, id=result[0][0],
+ admin_level=result[0][1])
entry_priority = 0 # Make these first in list
break
@@ -189,3 +189,13 @@ def _retrieve_missing_data_from_GIS(entries):
retval.append(e)
return retval
+
+
+
+if __name__ == "__main__":
+ import pprint, sys
+ pp = pprint.PrettyPrinter(indent=4)
+
+ for city in sys.argv[1:]:
+ print "###### %s:" % city
+ pp.pprint(query(city))
--
1.6.3.3