X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/e10d11c6c7a5a96f645b9155a55e56f874ed6042..d9e0ef0ebfbc2860e7c0b7e7510a4014300074be:/sql/functions.sql

diff --git a/sql/functions.sql b/sql/functions.sql
index 8ce36c54..89c1f936 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -561,14 +561,6 @@ BEGIN
     RETURN nearcountry.country_code;
   END LOOP;
 
--- RAISE WARNING 'natural earth: %', ST_AsText(place_centre);
-
-  -- Natural earth data
-  FOR nearcountry IN select country_code from country_naturalearthdata where st_covers(geometry, place_centre) limit 1
-  LOOP
-    RETURN nearcountry.country_code;
-  END LOOP;
-
 -- RAISE WARNING 'near osm fallback: %', ST_AsText(place_centre);
 
   -- 
@@ -577,14 +569,6 @@ BEGIN
     RETURN nearcountry.country_code;
   END LOOP;
 
--- RAISE WARNING 'near natural earth: %', ST_AsText(place_centre);
-
-  -- Natural earth data 
-  FOR nearcountry IN select country_code from country_naturalearthdata where st_dwithin(geometry, place_centre, 0.5) limit 1
-  LOOP
-    RETURN nearcountry.country_code;
-  END LOOP;
-
   RETURN NULL;
 END;
 $$
@@ -869,6 +853,9 @@ BEGIN
       END IF;
     ELSEIF NEW.class = 'boundary' AND NOT is_area THEN
         return NULL;
+    ELSEIF NEW.class = 'boundary' AND NEW.type = 'administrative'
+           AND NEW.admin_level <= 4 AND NEW.osm_type = 'W' THEN
+        return NULL;
     ELSEIF NEW.class = 'railway' AND NEW.type in ('rail') THEN
         return NULL;
     ELSEIF NEW.osm_type = 'N' AND NEW.class = 'highway' THEN
