maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH maposmatic 1/3] only try to lookup the negative


From: David Decotigny
Subject: [Maposmatic-dev] [PATCH maposmatic 1/3] only try to lookup the negative osm_id, and only when nominatim determined it through a relation
Date: Mon, 21 Dec 2009 11:47:11 +0100

---
 www/maposmatic/nominatim.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/www/maposmatic/nominatim.py b/www/maposmatic/nominatim.py
index 168f2c6..c02cc81 100644
--- a/www/maposmatic/nominatim.py
+++ b/www/maposmatic/nominatim.py
@@ -149,16 +149,16 @@ def _retrieve_missing_data_from_GIS(entries):
                 # We ignore all the other classes
                 continue
 
-            # Try to lookup in the OSM DB, when needed
-            if lookup_OSM:
+            # Try to lookup in the OSM DB, when needed and when it
+            # makes sense (ie. the data is coming from a relation)
+            if lookup_OSM and (entry.get('osm_type') == "relation"):
                 for table_name in ("polygon", "line"):
                     # Lookup the polygon/line table for both osm_id and
                     # the opposite of osm_id
                     cursor.execute("""select osm_id, admin_level
                                       from planet_osm_%s
-                                      where osm_id in (%s,-%s)""" \
-                                       % (table_name,
-                                          entry["osm_id"],entry["osm_id"]))
+                                      where osm_id = -%s""" \
+                                       % (table_name,entry["osm_id"]))
                     result = tuple(set(cursor.fetchall()))
                     if len(result) == 1:
                         entry["ocitysmap_params"] = dict(table=table_name,
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]