]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tools/database_import.py
cannot use capture_output in subprocess.run
[nominatim.git] / nominatim / tools / database_import.py
index 664d3c6b39ed2fafb57e45960c052ccd76401505..efbf2ec80c0c771dbea2e71390c5ba184b782280 100644 (file)
@@ -199,7 +199,7 @@ def load_data(dsn, threads):
         conn.perform("""INSERT INTO placex ({0})
                          SELECT {0} FROM place
                          WHERE osm_id % {1} = {2}
         conn.perform("""INSERT INTO placex ({0})
                          SELECT {0} FROM place
                          WHERE osm_id % {1} = {2}
-                           AND NOT (class='place' and type='houses')
+                           AND NOT (class='place' and (type='houses' or type='postcode'))
                            AND ST_IsValid(geometry)
                      """.format(_COPY_COLUMNS, place_threads, imod))
         sel.register(conn, selectors.EVENT_READ, conn)
                            AND ST_IsValid(geometry)
                      """.format(_COPY_COLUMNS, place_threads, imod))
         sel.register(conn, selectors.EVENT_READ, conn)
@@ -272,15 +272,15 @@ def create_country_names(conn, tokenizer, languages=None):
 
         with tokenizer.name_analyzer() as analyzer:
             for code, name in cur:
 
         with tokenizer.name_analyzer() as analyzer:
             for code, name in cur:
-                names = [code]
+                names = {'countrycode' : code}
                 if code == 'gb':
                 if code == 'gb':
-                    names.append('UK')
+                    names['short_name'] = 'UK'
                 if code == 'us':
                 if code == 'us':
-                    names.append('United States')
+                    names['short_name'] = 'United States'
 
                 # country names (only in languages as provided)
                 if name:
 
                 # country names (only in languages as provided)
                 if name:
-                    names.extend((v for k, v in name.items() if _include_key(k)))
+                    names.update(((k, v) for k, v in name.items() if _include_key(k)))
 
                 analyzer.add_country_names(code, names)
 
 
                 analyzer.add_country_names(code, names)